69 65 64
I've tried a half-dozen ways to get Replace to work the way I want it to without using the long
[regex]::Replace syntax, but I haven't had any luck. If anyone else has an idea of what might work, please do suggest it.
Changes from original:
- Rearranged last argument so that
[int] is no longer needed, per suggestion in comments.
(read-host) gets the user input.
) tells PowerShell to use RegEx matching to perform replacement operations on a string.
"[A-Z]" matches all uppercase letters.
} tells PowerShell to use a script to determine the replacement value.
[char]"$args" takes the current match and types it as an ASCII character.
32+ converts the character to an integer, representing the ASCII code, and increases the value by 32 - which would match ASCII code of the corresponding lowercase letter.
) takes the resulting value and converts it back to an ASCII character.
Demo of original:
(Current version tested - screenshot not yet posted.)