تبدیل اعداد داخل یه متن به اعداد فارسی

تبدیل اعداد داخل یه متن به اعداد فارسی
مثال عدد ۱ رو تبدیل میکنه به ۱

 

Sub ConvertNumbers2Persian(sNumber As String) As String
Dim sNumbers(10) As String
Dim res As String
Dim j As Int
res = sNumber
sNumbers(0) = "٠"
sNumbers(1) = "١"
sNumbers(2) = "٢"
sNumbers(3) = "٣"
sNumbers(4) = "۴"
sNumbers(5) = "۵"
sNumbers(6) = "۶"
sNumbers(7) = "٧"
sNumbers(8) = "٨"
sNumbers(9) = "٩٩"

For i =0 To sNumber.Length - 1
j = sNumber.SubString2(i,i+1)
res = res.Replace(sNumber.CharAt(i),sNumbers(j))
Next
Return res
End Sub

 

دیدگاهتان را بنویسید