-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathfunction-ReplaceUmlaute-example.ps1
More file actions
40 lines (33 loc) · 1.32 KB
/
function-ReplaceUmlaute-example.ps1
File metadata and controls
40 lines (33 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#-----------------------------------------------------------[Functions]------------------------------------------------------------
# -----------------------------------------------------------------------------
# Type: Function
# Name: ReplaceUmlaute
# Description: Replace all Umlaute and Leerzeichen with Hashtable
# Parameters: Textstring
# Return Values:
# Requirements:
# -----------------------------------------------------------------------------
function ReplaceUmlaute {
param (
[Parameter(Mandatory=$True)]
[string] $strText
)
# create HashTable with replace map
$characterMap = @{}
$characterMap.([Int][Char]'ä') = "ae"
$characterMap.([Int][Char]'ö') = "oe"
$characterMap.([Int][Char]'ü') = "ue"
$characterMap.([Int][Char]'ß') = "ss"
$characterMap.([Int][Char]'Ä') = "Ae"
$characterMap.([Int][Char]'Ü') = "Ue"
$characterMap.([Int][Char]'Ö') = "Oe"
$characterMap.([Int][Char]'ß') = "ss"
# Replace chars
ForEach ($key in $characterMap.Keys) {
$strText = $strText -creplace ([Char]$key),$characterMap[$key]
}
# return result
$strText
}
#-----------------------------------------------------------[Execution]------------------------------------------------------------
ReplaceUmlaute -strText "ÄÖÜöäü"