示例: 考虑如下字符串:
String a="This line1 has a,b,c,\nThis line2 has d,e,f, \nThis line3 has g,h,i";
System.out.println(a);
输出:
This line1 has a,b,c,
This line2 has d,e,f,
This line3 has g,h,i
由于这是一个多行字符串,我如何才能从输出中删除每行最后出现的逗号并打印如下所示的输出?
This line1 has a,b,c
This line2 has d,e,f
This line3 has g,h,i
www说
相关分类