用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!
热门推荐
10 诗意新婚祝福语高级简短
11 二胎祝福语简短霸气
12 收围巾的祝福语简短
13 妈妈生日祝福语简短温暖
14 广东新居入伙简短祝福语
15 枣庄人事考试祝福语简短
16 甄嬛传祝福语简短
17 朋友弟弟生日祝福语简短
18 小年好的祝福语简短