2019-08-13 02:24:18 +03:00

11 lines
392 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Foundation
public func convertToArabicNumeralString(_ string: String) -> String {
var string = string
let arabicNumbers = ["٠": "0", "١": "1", "٢": "2", "٣": "3", "٤": "4", "٥": "5", "٦": "6", "٧": "7", "٨": "8", "٩": "9"]
for (arabic, generic) in arabicNumbers {
string = string.replacingOccurrences(of: generic, with: arabic)
}
return string
}