------ Solution ---------------------- ----------------------
regular expressions , replaceAll
I love AV data?
------ Solution - -------------------------------------------
String str = "youloveAVdata[221]xxdata[ab]";< br> ------ For reference only ---------------------------------------
str = str.replaceAll("\\[(.+?)\\]", "$1");
System.out.println(str);
String str = "youloveAVdata[221]xxdata[ab]";
str = str.replaceAll("data\\[(.?)\\]", "$1");
System.out.println(str);
positive solution , a little less "data", it may be data [], I did not mention
------ For reference only ------------ ---------------------------
+1
------ For reference only - -------------------------------------
bright ,
- ---- For reference only ---------------------------------------
< br />
String str = "youloveAVdata[221]xxdata[ab]";
//+改成*
str = str.replaceAll("\\[(.*?)\\]", "$1");
System.out.println(str);
------ For reference only ----------------------------------- ----
replaceAll ("data [", ""); replaceAll ("]", ""); so what is the problem you
没有评论:
发表评论