This is one of the solutions.
Function Convert(ByVal input As String) As String Dim source = "٠١٢٣٤٥٦٧٨٩" Dim target = "0123456789" Dim sb As New StringBuilder() For Each el in Input sb.Append(target(source.IndexOf(el))) Next Return sb.ToString End Function
EDIT
I tried to find more "native" ways. I found the NativeDigits property of the NumberFormatInfo class
This was my test code, but it failed. But that could be a good starting point.
Dim source = "١٢٣٤٥٦٧٨٩" Dim result As Integer Dim numInfo As new NumberFormatInfo() numInfo.NativeDigits = New String() { "٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩" } Int32.TryParse(source, NumberStyles.Any, numInfo, result)
Oybek source share