Created
May 4, 2016 02:43
-
-
Save midnightfreddie/413c83a96a8298bc4e30b7a64645da3e to your computer and use it in GitHub Desktop.
Random silliness: Adding a combining glyph to every a-z character in a string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Silliness. U0300 - U0036F are combining unicode characters | |
# https://en.wikipedia.org/wiki/Combining_Diacritical_Marks | |
$String = "The quick, brown fox jumped over the lazy dog" | |
$Combining = 0x0300 .. 0x036F | ForEach-Object { [char]$_ } | Sort-Object { Get-Random } | |
$i = 0 | |
($String.ToCharArray() | ForEach-Object { $_ -replace '[A-Za-z]', "`$0$($Combining[$i++])" }) -join "" | |
# This looks a mess in ISE but will display "properly" in a browser or word processor when copied and pasted | |
# T͢h̖e͘ q̬u̚i̋c͝k͠, bͧr͉o͐w͟n̅ f͔oͤx̥ j̙uͅm̲p̸e̺d͞ oͣv͆eͨr͕ t̄h͜eͭ ļąz̉ẏ d̈́o͇g͖ | |
# TODO: Currently the index will be out of range if (the number of alphabet characters in $String) -gt 112 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment