Home > Back-end >  Your bosses, how will the suffix number of names hidden as threes 1 into threes
Your bosses, how will the suffix number of names hidden as threes 1 into threes

Time:12-12

CodePudding user response:

 
String regex="([\u4e00-\u9fa5]+)";
String STR="zhang SAN 1";
The Matcher Matcher=Pattern.com running (regex). The Matcher (STR);
If (the matcher. The find ()) {
System.out.println(matcher.group(0));
}

Refer to https://www.cnblogs.com/yaomajor/p/7001516.html

CodePudding user response:

If it is pure Chinese characters and then combined with pure digital form, refer to the following code:
 
String STR="zhang SAN 1";
Char [] chars=STR. ToCharArray ();
for(int i=0 ; iIf (Character. IsDigit (chars) [I]) {
System. The out. Println (STR. The substring (0, I));
break;
}
}

CodePudding user response:

 
String STR="zhang SAN 1";
StringBuffer words=new StringBuffer();
StringBuffer nums=new StringBuffer ();
Char [] chars=STR. ToCharArray ();
for(int i=0 ; iIf (Character. IsDigit (chars) [I]) {
nums.append(chars[i]);
} else {
Words. Append (chars [I]);
}
}
System.out.println(words);

CodePudding user response:

String s="10086" zhang SAN. ReplaceAll (" \ \ d + $", "");

CodePudding user response:

  • Related