Parameters: the String STR, String the begin, String end;
Role: STR string in all begin with the begin and end with the end of the string
Output is: the String []
For example: [110011] 0 a0b0c [0001] of the query result there should be two strings: 110011, and 0001
CodePudding user response:
Public static void found (String STR, String the begin, the String end) {int a=0;
Int b=0;
Int c=0;
List
While (StringUtils. IsNotBlank (STR)) {
A=STR. IndexOf (begin) + 1;
B=STR. IndexOf (end);
If (bSTR=STR. The substring (a - 1);
A=STR. IndexOf (begin) + 1;
B=STR. IndexOf (end);
}
String substring=STR. The substring (a, b);
List. The add (substring);
STR=STR. The substring (b + 1);
}
System.out.println(list);
}
CodePudding user response:
String STR []={" sadd ", "fasdf", "dddass"};for(int i=0; I
System. The out. Println (STR [I]);
}
}
The basic ideas, specific oneself confidence
CodePudding user response:
Public static String [] get String (String STR, String the begin, the String end) {The Pattern p=Pattern.com running (the begin + ". * "+ end);
The Matcher m=p. atcher (STR);
If (m. ind ()) {
Return a new String [] {begin and end};
}
Return null;
}
Only to arrive at the begin and end? A bit of a mystery
CodePudding user response:
Public static String find (String STR, String the begin, the String end) {If (STR. ToLowerCase (). The startsWith (begin) & amp; & STR. ToLowerCase (). The endsWith (end)) {
return str;
}
return "";
}
CodePudding user response:
CodePudding user response:
I wrote a way of considering situations, you can refer to https://blog.csdn.net/WORDHERO001/article/details/108644966CodePudding user response:
The