Home > Mobile >  Android studio
Android studio

Time:11-12

How when click the modify button, limited cell phone number for only 11 o if convenient can you give the code, thank you

CodePudding user response:

The editText. GetText length

CodePudding user response:

reference 1/f, good a will reply:
editText. The length of getText

This seems to be the largest digits, can only modify success is 11

CodePudding user response:

This seems to be the largest digits, can only modify success is 11

CodePudding user response:

The if... !=... :
.
.
.

CodePudding user response:

refer to fifth floor Micraow Peng reply:
the if... !=... :
.
.
.

Don't know much about can point in detail

CodePudding user response:

Use regular expressions to judge
$//^ \ d {11}

CodePudding user response:

reference cat 6 floor?? Response:
Quote: refer to fifth floor Micraow Peng reply:
the if... !=... :
.
.
.

Don't know much about can you detailed point

I also not understand, I think I should is this logic, if a phone number length (to use length)!=
(the meaning of the is not equal to) 11:
After what output you want in on this,

CodePudding user response:

The
references to the eighth floor Micraow Peng reply:
Quote: refer to 6th floor cat?? Response:
Quote: refer to fifth floor Micraow Peng reply:
the if... !=... :
.
.
.

Don't know much about can you detailed point

I also not understand, I think I should is this logic, if a phone number length (to use length)!=
(the meaning of the is not equal to) 11:
After what output you want in on this,

Ok, thank you

CodePudding user response:

Public final static String PHONE_PATTERN="^ ((1 [0-9] [0-9])) \ \ d {8} $";
/* *
* regular expression matching judgment
* @ param
* @ param input needs to be done to match action of string
* @ return true if matched, else false
*/
Public static Boolean isPhoneNumber (CharSequence input) {
The Pattern the Pattern=Pattern.com running (PHONE_PATTERN);
The Matcher Matcher.=the pattern Matcher (input);
If (the matcher. The find ()) {
return true;
}
return false;
}


Through this method to judge whether the input for the mobile phone number