Skip to content

Instantly share code, notes, and snippets.

@otuva
Created November 1, 2024 10:39
Show Gist options
  • Save otuva/45758f42990e011f01176e32954441eb to your computer and use it in GitHub Desktop.
Save otuva/45758f42990e011f01176e32954441eb to your computer and use it in GitHub Desktop.
# Define a dictionary of Turkish characters and their replacements
$turkishChars = @{
'ç' = 'c'
'Ç' = 'C'
'ğ' = 'g'
'Ğ' = 'G'
'ı' = 'i'
'İ' = 'I'
'ö' = 'o'
'Ö' = 'O'
'ş' = 's'
'Ş' = 'S'
'ü' = 'u'
'Ü' = 'U'
}
# Original string with Turkish characters
$string = "Çeşitli Türkçe karakterler: ç, ğ, ı, İ, ö, Ö, ş, Ş, ü, Ü"
# Replace each Turkish character with its equivalent
foreach ($char in $turkishChars.Keys) {
$string = $string -replace [regex]::Escape($char), $turkishChars[$char]
}
# Display the modified string
$string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment