62,623
社区成员
发帖
与我相关
我的任务
分享import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class w
{
public static void main(String[] aa)
{
String target = "GPEP2uVA2yEufDOaCOGMkw--ALZ";
Matcher matcher = Pattern.compile("^(.+)(.)(.)(.)$").matcher(target);
String parity = "";
String str = "";
String len1 = "";
String len2 = "";
if(matcher.find()){
parity = matcher.group(1).toString();
len2 = matcher.group(2).toString();
len1 = matcher.group(3).toString();
str = matcher.group(4).toString();
}
System.out.println(parity);
System.out.println(len2);
System.out.println(len1);
System.out.println(str);
}
}
String target = "GPEP2uVA2yEufDOaCOGMkw--ALZ"
Matcher matcher = Pattern.compile("/^(.+)(.)(.)(.)$/").matcher(target);
String parity = "";
String str = "";
String len1 = "";
String len2 = "";
if(matcher.find()){
parity = matcher.group(1).toString();
len2 = matcher.group(2).toString();
len1 = matcher.group(3).toString();
str = matcher.group(4).toString();
}
// 其中if直接为false ,郁闷,高手看看