云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > StringUtils

StringUtils

  • 62 次阅读
  • 3 次下载
  • 2025/12/3 1:53:12

78.public static String chop(String str)

去掉字符串str的最后一个字符。

如果字符串以\结尾,则去掉它们。

这里不再举例。

79.public static String repeat(String str, int repeat)

重复字符串repeat次,组合成一个新串返回。

如果字符串str为null或\,则返回它本身

如果repeat小于0,则返回\

举例(*表示任意):

StringUtils.repeat(null, *) = null

StringUtils.repeat(\

StringUtils.repeat(\

StringUtils.repeat(\

StringUtils.repeat(\

80.public static String rightPad(String str, int size)

如果str为null,则返回null

如果字符串长度小于size,则在右边补空格使其长度等于size,然后返回

如果字符串长度大于等于size,则返回它本身

这里不再举例。

81.public static String rightPad(String str, int size, char padChar)

和80类似,只是补的字符为padChar。

这里不再举例。

82.public static String rightPad(String str, int size, String padStr)

和80类似,只是补的是字符串padStr。

举例(*表示任意):

StringUtils.rightPad(null, *, *) = null

StringUtils.rightPad(\

StringUtils.rightPad(\

StringUtils.rightPad(\

StringUtils.rightPad(\

StringUtils.rightPad(\

StringUtils.rightPad(\

StringUtils.rightPad(\

StringUtils.rightPad(\

StringUtils.rightPad(\

StringUtils.rightPad(\

83.public static String leftPad(String str, int size)

和80类似,只是补左边。

这里不再举例。

84.public static String leftPad(String str, int size, char padChar)

和81类似。

这里不再举例。

85.public static String leftPad(String str, int size, String padStr)

和82类似。

这里不再举例。

86.public static String center(String str, int size)

产生一个字符串返回,该字符串长度等于size,str位于新串的中心,其他位置补空格。

如果str为null,则返回null

如果size小于str的长度,则返回str本身

举例(*表示任意):

StringUtils.center(null, *) = null

StringUtils.center(\

StringUtils.center(\

StringUtils.center(\

StringUtils.center(\

StringUtils.center(\

StringUtils.center(\

StringUtils.center(\

87.public static String center(String str, int size, char padChar)

和86类似,只是其他位置补padChar。

这里不再举例。

88.public static String center(String str, int size, String padStr)

和86类似,只是其他位置补padStr。

这里不再举例。

89.public static String swapCase(String str)

把字符串中的字符大写转换为小写,小写转换为大写。

举例:

StringUtils.swapCase(null) = null

StringUtils.swapCase(\

StringUtils.swapCase(\

StringUtils.swapCase(\

90.public static int countMatches(String str, String sub)

计算字符串sub在字符串str中出现的次数。

如果str为null或\,则返回0

举例(*表示任意):

StringUtils.countMatches(null, *) = 0

StringUtils.countMatches(\

StringUtils.countMatches(\

StringUtils.countMatches(\

StringUtils.countMatches(\

StringUtils.countMatches(\

StringUtils.countMatches(\

搜索更多关于: StringUtils 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

78.public static String chop(String str) 去掉字符串str的最后一个字符。 如果字符串以\结尾,则去掉它们。 这里不再举例。 79.public static String repeat(String str, int repeat) 重复字符串repeat次,组合成一个新串返回。 如果字符串str为null或\,则返回它本身 如果repeat小于0,则返回\ 举例(*表示任意): StringUtils.repeat(null, *) = null StringUtils.repeat(\ StringUtils.repeat(\ Strin

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com