81,122
社区成员




String regex = "\\*+";
System.err.println("**TEST*11".replaceFirst(regex, ""));
public static void main(String args[]) {
String testStr = "**TEST*11";
String subStr = "";
// 记录*号首次结束的位置
int starEnd = 0;
for (int i = 0; i < testStr.length(); i++) {
subStr = testStr.substring(i, i + 1);
if (!"*".equals(subStr)) {
starEnd = i;
break;
}
}
// 结果
String result = testStr.substring(starEnd, testStr.length());
System.out.println(result);
}
String a = "**TEST*11";
int i = a.indexOf("TEST");
System.out.println(a.substring(i));