如:“测试字符串-这个字符串后面有回车否,怎么去掉?
”;
”;
解决方案 »
- 重写了equals和hashcode方法为什么用==判断返回false???
- java高手请进
- 闲来无事,贴个Java实现的银行家问题代码
- System.arraycopy的要怎么实现啊?
- 如何在JBuilder中象MsgBox一样弹出一个对话框?
- 请问java 可有unix下compress的压缩类(.Z文件)
- 如何打包和调用自己的类包?****************************************************************
- 如何在主程序中得到主程序生成的JFrame中函数的返回值?
- 请帮我看段程序!!!
- java中如何实现串口读写?
- 初学java,有个问题想请教各位
- 异常继承自定义用户信息问题
System.out.println("ok");
System.out.print("测试字符串-这个字符串后面有回车否,怎么去掉?\n\r".replaceAll("[\r\n]*$", ""));
System.out.println("ok");
public class Test {
public static void main(String[] args) {
String src = "测试字符串-这个字符串后面有回车否,怎么去掉?\r\n";
System.out.println("-----------------");
System.out.println(src);
System.out.println("-----------------");
System.out.println(src.trim());
System.out.println("-----------------");
}
}输出:
-----------------
测试字符串-这个字符串后面有回车否,怎么去掉?���-----------------
测试字符串-这个字符串后面有回车否,怎么去掉?���
-----------------
text = text.replaceAll("[\r\n]*", ""));不知道理解得对不对
兄台,,不是啊 !如下:
源:String string = "this is test-stri
ng";
目的:String string = "this is test-string";
兄台,,不是啊 !如下:
源:[/color]String string = "this is test-stri
ng";
目的:[/color]String string = "this is test-string";
源:String string = "this is test-stri
ng";
目的:String string = "this is test-string";
什么意思啊?
这个?
String string = "this is test-string";
敲下回车
String string = "this is test-stri"+
"ng";