用Java标记字符串
我们有以下字符串-
String str = "This is demo text, and demo line!";
为了标记字符串,让我们在每个句点(。)和逗号(,)之后将它们分割
String str = "This is demo text, and demo line!";
以下是完整的示例。
示例
public class Demo { public static void main(String[] args) { String str = "This is demo text, and demo line!"; String[] res = str.split("[, .]", 0); for(String myStr: res) { System.out.println(myStr); } }}输出结果
This is demo text and demo line!
热门推荐
3 初八祝福语简短语
5 怎么说祝福语简短
10 结婚祝福语粤语大全简短
11 结婚祝福语简短精辟好记
12 农民朋友发财祝福语简短
13 春节后的祝福语简短
14 宝宝满月写真祝福语简短
15 接春的祝福语简短
16 理科元旦祝福语大全简短
17 三十三句祝福语简短
18 生日宝宝祝福语简短独特