Last active
November 6, 2019 14:18
-
-
Save manualbashing/4d03cedc05ec88e57c7a to your computer and use it in GitHub Desktop.
Replace Umlauts in #PowerShell with a replace function and regular expression
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
$replaceUmlaut = { | |
param ($Match) | |
$characterMap = New-Object System.Collections.Hashtable | |
$characterMap.ä = 'ae' | |
$characterMap.ö = 'oe' | |
$characterMap.ü = 'ue' | |
$characterMap.ß = 'ss' | |
$characterMap.Ä = 'Ae' | |
$characterMap.Ü = 'Ue' | |
$characterMap.Ö = 'Oe' | |
$characterMap.$Match | |
} | |
[Regex]::Replace('Lüsterner Spaß mit öligen Äpfeln.', '([ÄÖÜäöüß])', $replaceUmlaut) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment