Ilya Laktyushin 1e319a74fc Disallow eastern arabic numerals in passcode setup
Try to match western arabic passcode with eastern arabic for users who already stuck
2019-07-02 20:06:50 +02:00

11 lines
385 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
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
}