博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[例程]string.trim().length()的用法
阅读量:7022 次
发布时间:2019-06-28

本文共 381 字,大约阅读时间需要 1 分钟。

public class Test{
public static void main(String args[]){
String data = " a bc "; //调用string中的方法trim().length()方法 int trim = data.trim().length(); System.out.println("the trim length is "+trim); int length = data.length(); System.out.println("the length is "+length); } }

 

显示:

the trim length is 4

the length is 8

trim()方法的作用是去掉字符串头尾的空格.

转载地址:http://ahbxl.baihongyu.com/

你可能感兴趣的文章
使用PHP SoapClient 处理自建证书的https服务
查看>>
JAVA swing界面JFrame窗体的全局按键事件监听
查看>>
Windows Server 2008 R2虚拟机下安装 Oracle RAC 详解(grid)
查看>>
Android的系统目录概述
查看>>
视频分享:Elastic{ON}2017 Keynote 回顾
查看>>
smarty循环foreach,section实例详解
查看>>
MySQL 5.5.x my.cnf参数配置优化详解
查看>>
Delphi 目录操作
查看>>
js 变量声明 (var使用与不使用的区别)
查看>>
PHP字符串相关函数
查看>>
数据库的编码
查看>>
自动化端对端测试框架-Protractor Setup
查看>>
4. 分布式配置中心 springcloud-config-server
查看>>
python学习---面向对象的编程(四)
查看>>
python sox 修改音频文件采样率
查看>>
不同标准下去滚动条的办法
查看>>
js this
查看>>
人脸识别
查看>>
iOS Settings 自定义设置通用源码 XIB高效开发
查看>>
解决Navicat连接MySQL总是报错1251的方法
查看>>