Lessons Learned

My drop-site for interesting snippets and tips. If it's useful to you as well, great!

Browse by Tags

Tagged Content List
  • Blog Post: One-Liner: Fun with Multi-line Blocktext and –Split/.Split()

    The title is an oxymoron: I’m going to show a one-liner on how to deal with multi-line blocktext.  To start with, I’m using ‘blocktext’ to mean: $blocktext = @" This is an example using @" .. "@ "@; which is known from Unix-dom as ‘heretext’ and what I simply call...
  • Blog Post: Getting Version Data From Comment Based Help

    Disclaimer: There’s a lot of parse-by-prayer here. You Have Been Warned. Here’s the short form: I try to keep a change log of sorts in the comment-based help for my scripts. (I say try because that’s sadly the first thing to be omitted when I’m in a hurry. Code clarity is sadly...
  • Blog Post: Splitting a Hex-Encoded String into Pairs of Hex Characters (a.k.a. To Pull a Noah)

    Simple enough task: I have a hex-encoded string and need to decode it.  Now, we all know that to en code a string to hex is to cast each [char] to [int], then shove it through the "{0:X}" format specifier, then concatenate all the strings. $string = "The quick brown dog"; [string...
  • Blog Post: PowerShell One-Liner: Strings to Arrays and Back Again

    I'm (just) a old-school Perl hacker and miss their join() and split() functions. Turns out, while PowerShell doesn't have them, .NET does, to a point. PS> $home.split("\") C: Users timid And the other way around. PS> [String]::Join("|", $(gci)) Contacts|Desktop|Documents|Downloads|Favorites...
Page 1 of 1 (4 items)