`

org.apache.commons.lang.StringUtils处理字符串类

阅读更多

org.apache.commons.lang 
Class StringUtils

java.lang.Object

  org.apache.commons.lang.StringUtils


public class StringUtils

extends Object

Operations on String that are null safe. 字符串是null安全的,不会抛出NullPointerException,都做了相应的处理。

  • IsEmpty/IsBlank - checks if a String contains text
  • IsEmpty/IsBlank – 检查字符串是否有内容。
  • Trim/Strip - removes leading and trailing whitespace
  • Trim/Strip – 删除字符串开始和结尾的空白符。
  • Equals - compares two strings null-safe
  • Equals – 比较两个字符串null安全。
  • IndexOf/LastIndexOf/Contains - null-safe index-of checks
  • IndexOf/LastIndexOf/Contains – null安全的索引检查。
  • IndexOfAny/LastIndexOfAny/IndexOfAnyBut/LastIndexOfAnyBut - index-of any of a set of Strings
  • IndexOfAny/LastIndexOfAny/IndexOfAnyBut/LastIndexOfAnyBut – 字符串集合索引检查。
  • ContainsOnly/ContainsNone - does String contains only/none of these characters
  • ContainsOnly/ContainsNone – 字符在字符串中出现一次或一次也没有出现。
  • Substring/Left/Right/Mid - null-safe substring extractions
  • Substring/Left/Right/Mid – null安全子串的提取。
  • SubstringBefore/SubstringAfter/SubstringBetween - substring extraction relative to other strings
  • SubstringBefore/SubstringAfter/SubstringBetween – 子串提取依赖其它字符串。
  • Split/Join - splits a String into an array of substrings and vice versa
  • Split/Join – 字符串拆分为子串的字符串数组,反之亦然。
  • Remove/Delete - removes part of a String
  • Remove/Delete – 删除部分字符串。
  • Replace/Overlay - Searches a String and replaces one String with another
  • Replace/Overlay – 替换字符串的部分字符。
  • Chomp/Chop - removes the last part of a String
  • Chomp/Chop – 删除字符串最后的字符。
  • LeftPad/RightPad/Center/Repeat - pads a String
  • LeftPad/RightPad/Center/Repeat – 补字符串。
  • UpperCase/LowerCase/SwapCase/Capitalize/Uncapitalize - changes the case of a String
  • UpperCase/LowerCase/SwapCase/Capitalize/Uncapitalize – 改变字符串的大小写。
  • CountMatches - counts the number of occurrences of one String in another
  • CountMatches – 计算一个字符或字符串在另外一个字符串出现的次数。
  • IsAlpha/IsNumeric/IsWhitespace/IsAsciiPrintable - checks the characters in a String
  • IsAlpha/IsNumeric/IsWhitespace/IsAsciiPrintable – 判断字符是否在字符串中。
  • DefaultString - protects against a null input String
  • DefaultString –null安全,null转换为字符串。
  • Reverse/ReverseDelimited - reverses a String
  • Reverse/ReverseDelimited – 反转字符串。
  • Abbreviate - abbreviates a string using ellipsis
  • Abbreviate – 缩写字符串用省略符。
  • Difference - compares two Strings and reports on their differences
  • Difference – 比较两个字符串并且返回不同。
  • LevensteinDistance - the number of changes needed to change one String into another
  • LevensteinDistance – 一个字符串改变为另一个字符串需要改变的数量。

The StringUtils class defines certain words related to String handling.

StringUtils类是对字符串的处理。

  • null – null
  • empty - a zero-length string ("") 长度为0的字符串
  • space - the space character (' ', char 32) 间隔符
  • whitespace - the characters defined by Character.isWhitespace(char) 空格符
  • trim - the characters <= 32 as in String.trim()去掉字符串两边字符<=32

Version:

$Id: StringUtils.java 492377 2007-01-04 01:20:30Z scolebourne $

来自http://www.cnblogs.com/QQParadise/articles/1457767.html

分享到:
评论

相关推荐

    commons-lang3-3.1 StringUtils字符串jar包

    commons-lang3-3.1 StringUtils字符串jar包 org.apache.commons.lang3.StringUtils的jar包

    Java字符串加密使用的一个jar包 commons-lang3-3.1.jar下载

    Java字符串加密使用到的一个jar包 commons-lang3-3.1.jar下载 jar包含具体的类有 org.apache.commons.lang3.StringUtils org.apache.commons.lang3.ArrayUtils.class org.apache.commons.lang3.BitField.class org....

    commons-lang3-3.1 API

    org.apache.commons.lang包,这个包提供了一些有用的包含static方法的Util类。除了6个Exception类和2个已经deprecated的数字类之外,commons.lang包共包含了17个实用的类: ArrayUtils – 用于对数组的操作,如添加...

    stringUtils的jar包

    org.apache.commons.lang3.StringUtils的jar包,判断字符串为空

    在Java中轻松将HTML格式文本转换为纯文本(保留换行)

    第一步:引入Jsoup和lang和lang3的依赖: ...lang和lang3这两个包里有转换所需的工具类 org.jsoup jsoup 1.11.3 commons-lang ...import org.apache.commons.lang3.StringUtils; import org.jsoup.Jsoup; im

    commons-lang3-3.7

    commons-lang是Apache旗下最常用的工具之一,它提供了很多static方法供调用,其中包括了字符串操作、jvm交互、数组的复制,查找,获取子数组,反转等功能

    for循环中如何正确使用字符串拼接

    众所周知,常见的拼接方式有:StringBuffer,StringBuilder,...import org.apache.commons.lang3.StringUtils; public class Test { public static void main(String[] args) { long t1 = System.currentTimeMillis();

    stringUtils:通过 golang 移植 Apache commons lang

    字符串实用程序 通过 golang 移植 Apache commons lang 也可以看看

    ganymed-ssh2-build210.jar java远程访问linux服务器操作、上传下载文件

    import org.apache.commons.lang.StringUtils; import java.io.*; import java.util.logging.Level; /** * SCP远程访问Linux服务器读取文件 * User: boyer * Date: 17-12-7 * Time: 下午3:22 * To change ...

    RSA+bcpkix-jdk15.zip

    import org.apache.commons.lang.StringUtils; import com.jd.uwp.common.Constants; /** * RSA 工具类。提供加密,解密,生成密钥对等方法。 * 需要bcprov-jdk16-140.jar包。 * */ public class RSAUtil { ...

    Java中HTML转义与反转义工具类

    import org.apache.commons.lang3.StringUtils; /** * 转义和反转义工具类 * */ public class EscapeUtil { private static final char[][] TEXT = new char[64][]; static { for (int i = 0; i &lt; 64; i++)...

    Java数组的常用方法.doc

    可以使用 Apache Commons Lang 库的 StringUtils.join() 方法将一个数组元素放入一个字符串: String j = StringUtils.join(new String[] { "a", "b", "c" }, ", "); System.out.println(j); // a, b, c 8. 将一个...

    JAVA时间处理类

    import org.apache.commons.lang.StringUtils; /** * 日付に関するユーティリティクラス * */ public class DateUtil { /** * 年月日時のフォーマット(年月日) */ public static final String YYYYMMDD =...

    DL-TextMatch-开源

    Java中Damerau-Levenshtein模糊字符串匹配的实现。 返回距离,该距离为每个字符插入,删除,不匹配和交换增加一个点。...这是apache / commons / lang / StringUtils.getLevenshteinDistance()的扩展。

Global site tag (gtag.js) - Google Analytics