Is it possible to replace multiple characters with their corresponding mappings (o -> 0, Z -> 7, B = 8) by only using an input string, search pattern and replacement pattern?
1 Answer
Use a Dictionary(Of String, String) and in a loop String.Replace:
Dim replacementMapper As New Dictionary(Of String, String)
replacementMapper.Add("o", "0")
replacementMapper.Add("T", "7")
replacementMapper.Add("B", "8")
Dim inputString = "This is just an example which is completely pointless."
For Each kv In replacementMapper
inputString = inputString.Replace(kv.Key, kv.Value)
Next