Code Monkey home page Code Monkey logo

Comments (16)

iziz avatar iziz commented on August 29, 2024

Does "12345678900" number can use in CN ?
It will formatting valid phone number for each country.

from libphonenumber-ios.

iziz avatar iziz commented on August 29, 2024

For more information, you can check below link.
http://libphonenumber.googlecode.com/svn/trunk/javascript/i18n/phonenumbers/demo-compiled.html

screen shot 2015-01-21 at 10 02 17

from libphonenumber-ios.

jonathanxie avatar jonathanxie commented on August 29, 2024

12345678900 is not a valid CN number but I was hoping they could still format it to be like:

123 4567 8900

I can't control what the end user types in a UITextField so was just hoping for that...

in the end, it's still an invalid number.

Also, this might not be an issue with your library...but when I typed in 12345678900, and then hit the backspace key until I see 12345, I wasn't able to erase the 12345 from the UITextField embedded in UITableViewCell. I'm also using XLForm as the library to do the UITextField layout. This could be an issue with XLForm but not sure...

Any other number like 13612341234 works fine though...

from libphonenumber-ios.

iziz avatar iziz commented on August 29, 2024

Ah, I see..
It seems need some result method.
something like callback (or delegate) with error code.
I will consider it.

from libphonenumber-ios.

jonathanxie avatar jonathanxie commented on August 29, 2024

감사합니다 !

from libphonenumber-ios.

iziz avatar iziz commented on August 29, 2024

Sorry for late.

Use latest updated code in github (just add delegate)

{

...

NBAsYouTypeFormatter *formatter =

[[NBAsYouTypeFormatter alloc] initWithRegionCode:@"US"];

[formatter setDelegate:self];



NSLog(@"%@", [formatter inputDigit:@"2"]);

NSLog(@"%@", [formatter inputDigit:@"1"]);

NSLog(@"%@", [formatter inputDigit:@"2"]);

NSLog(@"%@", [formatter inputDigit:@"5"]);

NSLog(@"%@", [formatter inputDigit:@"5"]);

NSLog(@"%@", [formatter inputDigit:@"5"]);

NSLog(@"%@", [formatter inputDigit:@"5"]);

NSLog(@"%@", [formatter inputDigit:@"5"]);

NSLog(@"%@", [formatter inputDigit:@"5"]);

NSLog(@"%@", [formatter inputDigit:@"5"]);

NSLog(@"%@", [formatter inputDigit:@"5"]);

}

  • (void)formatter:(NBAsYouTypeFormatter *)formatter
    didFormatted:(BOOL)withResult

{

NSLog(@"didFormatted : %@", withResult ? @"YES":@"NO");

}

Shows

2015-04-01 01:08:34.195 libPhoneNumber[10967:3095377] didFormatted : YES

2015-04-01 01:08:34.195 libPhoneNumber[10967:3095377] 2

2015-04-01 01:08:34.195 libPhoneNumber[10967:3095377] didFormatted : YES

2015-04-01 01:08:34.195 libPhoneNumber[10967:3095377] 21

2015-04-01 01:08:34.195 libPhoneNumber[10967:3095377] didFormatted : YES

2015-04-01 01:08:34.196 libPhoneNumber[10967:3095377] 212

2015-04-01 01:08:34.196 libPhoneNumber[10967:3095377] didFormatted : YES

2015-04-01 01:08:34.196 libPhoneNumber[10967:3095377] 212-5

2015-04-01 01:08:34.197 libPhoneNumber[10967:3095377] didFormatted : YES

2015-04-01 01:08:34.197 libPhoneNumber[10967:3095377] 212-55

2015-04-01 01:08:34.197 libPhoneNumber[10967:3095377] didFormatted : YES

2015-04-01 01:08:34.197 libPhoneNumber[10967:3095377] 212-555

2015-04-01 01:08:34.197 libPhoneNumber[10967:3095377] didFormatted : YES

2015-04-01 01:08:34.197 libPhoneNumber[10967:3095377] 212-5555

2015-04-01 01:08:34.198 libPhoneNumber[10967:3095377] didFormatted : YES

2015-04-01 01:08:34.198 libPhoneNumber10967:3095377 555-55

2015-04-01 01:08:34.198 libPhoneNumber[10967:3095377] didFormatted : YES

2015-04-01 01:08:34.198 libPhoneNumber10967:3095377 555-555

2015-04-01 01:08:34.198 libPhoneNumber[10967:3095377] didFormatted : YES

2015-04-01 01:08:34.199 libPhoneNumber10967:3095377 555-5555

2015-04-01 01:08:34.199 libPhoneNumber[10967:3095377] didFormatted : NO

2015-04-01 01:08:34.199 libPhoneNumber[10967:3095377] 21255555555

Please give me some feedback.

On Wed, Jan 21, 2015 at 12:11 PM, jonathanxie [email protected]
wrote:

감사합니다 !


Reply to this email directly or view it on GitHub
https://github.com/iziz/libPhoneNumber-iOS/issues/42#issuecomment-70777729
.

from zen. [email protected]
http://about.me/ishtar
SungMin Ha (ishtar)
[image: http://]about.me/ishtar
http://about.me/ishtar

from libphonenumber-ios.

jonathanxie avatar jonathanxie commented on August 29, 2024

No problem on the late reply. Appreciate you trying to fix the issue.

I still get an issue:

2015-04-01 17:26:13.049 testapp[1246:469459] formattedNumber = 1
2015-04-01 17:26:13.051 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:14.387 testapp[1246:469459] formattedNumber = 12
2015-04-01 17:26:14.388 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:14.389 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:15.682 testapp[1246:469459] formattedNumber = 123
2015-04-01 17:26:15.682 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:15.682 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:15.683 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:18.166 testapp[1246:469459] formattedNumber = 1234
2015-04-01 17:26:18.166 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:18.167 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:18.167 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:18.168 testapp[1246:469459] didFormatted : NO
2015-04-01 17:26:20.124 testapp[1246:469459] formattedNumber = 12345
2015-04-01 17:26:20.125 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:20.126 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:20.127 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:20.130 testapp[1246:469459] didFormatted : NO
2015-04-01 17:26:20.130 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:22.809 testapp[1246:469459] formattedNumber = 12345 3
2015-04-01 17:26:22.811 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:22.811 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:22.813 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:22.817 testapp[1246:469459] didFormatted : NO
2015-04-01 17:26:22.817 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:22.818 testapp[1246:469459] didFormatted : NO
2015-04-01 17:26:24.068 testapp[1246:469459] formattedNumber = 12345
2015-04-01 17:26:24.069 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:24.070 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:24.071 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:24.075 testapp[1246:469459] didFormatted : NO
2015-04-01 17:26:24.076 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:24.896 testapp[1246:469459] formattedNumber = 12345 6
2015-04-01 17:26:24.897 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:24.897 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:24.898 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:24.901 testapp[1246:469459] didFormatted : NO
2015-04-01 17:26:24.902 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:24.904 testapp[1246:469459] didFormatted : NO
2015-04-01 17:26:26.772 testapp[1246:469459] formattedNumber = 12345
2015-04-01 17:26:26.774 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:26.774 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:26.775 testapp[1246:469459] didFormatted : YES
2015-04-01 17:26:26.778 testapp[1246:469459] didFormatted : NO
2015-04-01 17:26:26.780 testapp[1246:469459] didFormatted : YES

Also on my text field, I have to hold down the backspace button on the keyboard for quite some time to erase the "12345".

This also breaks for numbers that don't make sense in China: 12456, 12366, etc

from libphonenumber-ios.

iziz avatar iziz commented on August 29, 2024

Ah... I see, could you show me your test code ?

from libphonenumber-ios.

jonathanxie avatar jonathanxie commented on August 29, 2024

Here you go:

https://github.com/jonathanxie/libPhoneNumber-Test

from libphonenumber-ios.

jonathanxie avatar jonathanxie commented on August 29, 2024

Were you able to use my test code?

from libphonenumber-ios.

iziz avatar iziz commented on August 29, 2024

Yes please wait a few days :)

from libphonenumber-ios.

iziz avatar iziz commented on August 29, 2024

I think "delegate" is not good for this, so I removed it and check it for "isSuccessfulFormatting".

    textField.text = formattedNumber;
    NSLog(@"format result : %@",
        phoneNumberFormatter.isSuccessfulFormatting ? @"YES":@"NO");

from libphonenumber-ios.

iziz avatar iziz commented on August 29, 2024

Please give me any feedback :)

from libphonenumber-ios.

jonathanxie avatar jonathanxie commented on August 29, 2024

@iziz sorry, haven't had a chance to test yet...but I'l let you know as soon as I get a chance =)

from libphonenumber-ios.

iziz avatar iziz commented on August 29, 2024

Nop :) don't worry about that ~

from libphonenumber-ios.

iziz avatar iziz commented on August 29, 2024

Plz reopen this issue if not works fine.

from libphonenumber-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.