您的位置:首页 >Java中trim如何用
发布于2023-05-02 阅读(0)
扫一扫,手机访问
1、说明
trim()是Java开发人员最常用的删除前导和尾随空格的方法。对于trim()方法,空格字符是指*ASCII值小于或等于32('U + 0020')*的任何字符。
trim()方法返回调用字符串对象的一个副本,但是所有起始和结尾都被删掉了。
2、实例
public class FunTester {
public static void main(String[] args) {
String string = " one two three ";
System.out.println("原始字符串: \"" + string +"\"");
System.out.println("处理结果: \"" + string.trim() +"\"");
}
}
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
售后无忧
立即购买>office旗舰店
正版软件
正版软件
正版软件
正版软件
正版软件
1
2
3
7
9