十个最常用的StringUtils方法.docxVIP

  • 5
  • 0
  • 约4.71千字
  • 约 7页
  • 2017-05-27 发布于河南
  • 举报
十个最常用的StringUtils方法

1.取得字符串的缩写?使用函数: StringUtils.abbreviate(testString,width)和StringUtils.abbreviate(testString,offset,width)? 函数介绍:在给定的width内取得testString的缩写,当testString的长度小于width则返回原字符串.? 例程: ? ?? String test = This is a test of the abbreviation.; ? ?? String test2 = Test; ?? ?? System.out.println( StringUtils.abbreviate( test, 15 ) ); ? ?? System.out.println( StringUtils.abbreviate( test, 5,15 ) ); ? ?? System.out.println( StringUtils.abbreviate( test2, 10 ) );? 输出如下: This is a te... ...is a test... Tes 2.查找嵌套字符串?使用函数:StringUtils.substringBetween(testString,header,tail)? 函数介绍:在testString中取得header和tail之间的字符串。不存在

文档评论(0)

1亿VIP精品文档

相关文档