- 450 名前:デフォルトの名無しさん mailto:sage [2015/08/27(木) 04:05:08.66 ID:hd6aR505.net]
- パターンの再利用を考えるならこれ
final Pattern regex = Pattern.compile("\\!|\\$\\$|\\%"); String str = "abcd%efg!hijklmn"; String[] temp = regex.split(str, 2); if (temp.length == 2) { str = temp[0]; System.out.println(str); } else { System.out.println("nothing!"); }
|

|