String[] ss = new String[]{"a98b", "c0912d", "c10b", "a12345678d", "ab"}; for(String s: ss) System.out.println(s.matches("[ac]\\d*[bd]")); |
true true true true true |
public String[] split(String regex) public String[] split(String regex, int limit) |
String s = "GET /index.html HTTP/1.1"; String ss[] = s.split(" +"); for(String str: ss) System.out.println(str); |
GET /index.html HTTP/1.1 |
String s = "a0b1c3456"; String ss[] = s.split("\\d", 3); for(String str: ss) System.out.println(str); |
a b c3456 |
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |