-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Brazilian format is wrong #21
Comments
Thanks for your issue. Now it's not available to set multiple formats ( |
Imagine the user type +55 than any digits. How the app should be available to distinguish between two patterns? Are there any characteristics which inherent to one and another pattern? Maybe unique digit sequence of concrete numbers? |
this might be a good help also this one: https://gist.github.com/MauricioMoraes/2885d4975ac5e52d0ad7 all of those are using question mark "?" in the mask, maybe some regex detect it The input will change the mask as the user types |
So, according the second code, is it would be correct if mask would apply only when the last character typed? Cos this code apply the mask depending on phone length. If 9 characters it's one pattern. If 10, than the other. |
yep, it changes the mask when the last character is typed, also it change where the hyphen "-" is I think i've done a long time ago a mask for this case using objective-c as well, i will try to find it tomorrow. Dunno if i still have the code. |
Found a solution: https://github.com/Serheo/SHSPhoneComponent It adds more than 1 pattern, just loop through the patterns and add //patter 1
[self.phoneField.formatter setDefaultOutputPattern:@"##########" imagePath:nil];
//patter 2
[self.phoneField.formatter addOutputPattern:@"+# (###) ###-##-##" forRegExp:@"^7[0-689]\\d*$" imagePath:@"flagRU"];
//patter 3
[self.phoneField.formatter addOutputPattern:@"+### (##) ###-###" forRegExp:@"^374\\d*$" imagePath:@"flagAM"]; but, the regex must match the brazilian digits (9 or 10 digits) |
Thanks🙆, ill watch this closely in a free time. |
Further discussion there: #33 |
We have 2 patterns:
+55 (XX) XXXXX-XXXX
and
+55 (XX) XXXX-XXXX
country code
state code (2 digits)
4 or 5 digits, then 4 digits
It depends on which state the number is
The text was updated successfully, but these errors were encountered: