- 浏览: 260523 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
zhagener:
package com.huawei.qyq.impl;imp ...
EasyMock使用说明 -
LetCode:
将String转换成InputStream -
Mr_kimilo:
MyEclipse6.5安装的时候出现问题: JS Test ...
javascript测试工具: JsTestDriver -
jersey109:
我同意楼下的,SQLException和IOException ...
check exception和uncheck exception -
jersey109:
楼主,你不说CODE,我觉得你对RuntimeExceptio ...
check exception和uncheck exception
StringUtils api 中文 英文 对照
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.
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:
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 $
Field Summary字段摘要
static String
EMPTY
The empty String "".空字符串。
static int
INDEX_NOT_FOUND
Represents a failed index search. 声明失败索引。
static String
EMPTY
The empty String "".空字符串。
static int
INDEX_NOT_FOUND
Represents a failed index search. 声明失败索引。
Constructor Summary构造方法摘要
StringUtils()
StringUtils instances should NOT be constructed in standard programming.StringUtils 所有方法都是静态方法,不能在程序中对其进行构造。
StringUtils()
StringUtils instances should NOT be constructed in standard programming.StringUtils 所有方法都是静态方法,不能在程序中对其进行构造。
Method Summary方法摘要
static String
abbreviate(String str, int maxWidth)
Abbreviates a String using ellipses.
static String
abbreviate(String str, int maxWidth)
Abbreviates a String using ellipses.
取得字符串的缩写,str:处理的字符串,maxWidth:宽度,从第一个字符开始[1,maxWidth),类似于substring(),返回一个新的字符串,它是此字符串的一个子字符串。
static String
abbreviate(String str, int offset, int maxWidth)
Abbreviates a String using ellipses.
static String
abbreviate(String str, int offset, int maxWidth)
Abbreviates a String using ellipses.
取得字符串的缩写,str:处理的字符串,maxWidth:宽度,从第offset个字符开始[offset,axWidth),类似于substring(),返回一个新的字符串,它是此字符串的一个子字符串。
static String
capitalise(String str)
Deprecated. Use the standardly named capitalize(String). Method will be removed in Commons Lang 3.0.
static String
capitalise(String str)
Deprecated. Use the standardly named capitalize(String). Method will be removed in Commons Lang 3.0.
过时了.用 capitalize(String),在Commons Lang 3.0已经没有此方法了。
static String
capitaliseAllWords(String str)
Deprecated. Use the relocated WordUtils.capitalize(String). Method will be removed in Commons Lang 3.0.
static String
capitaliseAllWords(String str)
Deprecated. Use the relocated WordUtils.capitalize(String). Method will be removed in Commons Lang 3.0.
过时了. 在Commons Lang 3.0已经没有此方法了。
static String
capitalize(String str)
Capitalizes a String changing the first letter to title case as per Character.toTitleCase(char).
static String
capitalize(String str)
Capitalizes a String changing the first letter to title case as per Character.toTitleCase(char).
将str手写字母大写,用于名称、头衔等
static String
center(String str, int size)
Centers a String in a larger String of size size using the space character (' ').
static String
center(String str, int size)
Centers a String in a larger String of size size using the space character (' ').
产生一个字符串返回,该字符串长度等于size,str位于新串的中心,其他位置补空格。
如果str为null,则返回null
如果size小于str的长度,则返回str本身
static String
center(String str, int size, char padChar)
Centers a String in a larger String of size size.
如果str为null,则返回null
如果size小于str的长度,则返回str本身
static String
center(String str, int size, char padChar)
Centers a String in a larger String of size size.
产生一个字符串返回,该字符串长度等于size,str位于新串的中心,其他位置补字符padChar。
如果str为null,则返回null
如果size小于str的长度,则返回str本身
static String
center(String str, int size, String padStr)
Centers a String in a larger String of size size.
如果str为null,则返回null
如果size小于str的长度,则返回str本身
static String
center(String str, int size, String padStr)
Centers a String in a larger String of size size.
产生一个字符串返回,该字符串长度等于size,str位于新串的中心,其他位置补字符串padStr。
如果str为null,则返回null
如果size小于str的长度,则返回str本身
static String
chomp(String str)
Removes one newline from end of a String if it's there, otherwise leave it alone.
如果str为null,则返回null
如果size小于str的长度,则返回str本身
static String
chomp(String str)
Removes one newline from end of a String if it's there, otherwise leave it alone.
以单个词为单位的反转
str=”I am yuanyuan !”;
chomp(str)=”! yuanyuan an I”;
static String
chomp(String str, String separator)
Removes separator from the end of str if it's there, otherwise leave it alone.
static String
chomp(String str, String separator)
Removes separator from the end of str if it's there, otherwise leave it alone.
以单个词为单位的反转,从separator开始
str=”I am yuanyuan !”;
chomp(str ,”!”)=” yuanyuan an I !”;
static String
chompLast(String str)
Deprecated. Use chomp(String) instead. Method will be removed in Commons Lang 3.0.
static String
chompLast(String str)
Deprecated. Use chomp(String) instead. Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static String
chompLast(String str, String sep)
Deprecated. Use chomp(String,String) instead. Method will be removed in Commons Lang 3.0.
static String
chompLast(String str, String sep)
Deprecated. Use chomp(String,String) instead. Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static String
chop(String str)
Remove the last character from a String.
static String
chop(String str)
Remove the last character from a String.
去掉字符串str的最后一个字符。如果字符串以"\r\n"结尾,则去掉它们。
static String
chopNewline(String str)
Deprecated. Use chomp(String) instead. Method will be removed in Commons Lang 3.0.
static String
chopNewline(String str)
Deprecated. Use chomp(String) instead. Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static String
clean(String str)
Deprecated. Use the clearer named trimToEmpty(String). Method will be removed in Commons Lang 3.0.
static String
clean(String str)
Deprecated. Use the clearer named trimToEmpty(String). Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static String
concatenate(Object[] array)
Deprecated. Use the better named join(Object[]) instead. Method will be removed in Commons Lang 3.0.
static String
concatenate(Object[] array)
Deprecated. Use the better named join(Object[]) instead. Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static boolean
contains(String str, char searchChar)
Checks if String contains a search character, handling null.
static boolean
contains(String str, char searchChar)
Checks if String contains a search character, handling null.
当此字符串包含指定的字符searchChar 值序列时,返回 true;处理null。
static boolean
contains(String str, String searchStr)
Checks if String contains a search String, handling null.
static boolean
contains(String str, String searchStr)
Checks if String contains a search String, handling null.
当此字符串包含指定的字符串searchStr 值序列时,返回 true;处理null。
static boolean
containsIgnoreCase(String str, String searchStr)
Checks if String contains a search String irrespective of case, handling null.
static boolean
containsIgnoreCase(String str, String searchStr)
Checks if String contains a search String irrespective of case, handling null.
当此字符串包含指定的字符串searchStr 值序列时,忽略大小写,返回 true;处理null。
static boolean
containsNone(String str, char[] invalidChars)
Checks that the String does not contain certain characters.
static boolean
containsNone(String str, char[] invalidChars)
Checks that the String does not contain certain characters.
判断是否字符串str不包含字符数组invalidChars中的字符,如果含有则返回false。
static boolean
containsNone(String str, String invalidChars)
Checks that the String does not contain certain characters.
static boolean
containsNone(String str, String invalidChars)
Checks that the String does not contain certain characters.
判断是否字符串str不包含字符串invalidChars,如果含有则返回false。
static boolean
containsOnly(String str, char[] valid)
Checks if the String contains only certain characters.
static boolean
containsOnly(String str, char[] valid)
Checks if the String contains only certain characters.
判断是否字符串str包含字符数组valid中的字符,如果含有则返回true。
static boolean
containsOnly(String str, String validChars)
Checks if the String contains only certain characters.
static boolean
containsOnly(String str, String validChars)
Checks if the String contains only certain characters.
判断是否字符串str包含字符串invalidChars,如果含有则返回true。
static int
countMatches(String str, String sub)
Counts how many times the substring appears in the larger String.
static int
countMatches(String str, String sub)
Counts how many times the substring appears in the larger String.
计算字符串sub在字符串str中出现的次数。如果str为null或"",则返回0
static String
defaultIfEmpty(String str, String defaultStr)
Returns either the passed in String, or if the String is empty or null, the value of defaultStr.
static String
defaultIfEmpty(String str, String defaultStr)
Returns either the passed in String, or if the String is empty or null, the value of defaultStr.
如果str不是空或者null,返回str,否则返回defaultStr。
static String
defaultString(String str)
Returns either the passed in String, or if the String is null, an empty String ("").
static String
defaultString(String str)
Returns either the passed in String, or if the String is null, an empty String ("").
如果str不是空返回str,否则返回""。
static String
defaultString(String str, String defaultStr)
Returns either the passed in String, or if the String is null, the value of defaultStr.
static String
defaultString(String str, String defaultStr)
Returns either the passed in String, or if the String is null, the value of defaultStr.
如果str不为空,返回str,否则返回defaultStr
static String
deleteSpaces(String str)
Deprecated. Use the better localized deleteWhitespace(String). Method will be removed in Commons Lang 3.0.
static String
deleteSpaces(String str)
Deprecated. Use the better localized deleteWhitespace(String). Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static String
deleteWhitespace(String str)
Deletes all whitespaces from a String as defined by Character.isWhitespace(char).
static String
deleteWhitespace(String str)
Deletes all whitespaces from a String as defined by Character.isWhitespace(char).
删除字符串中的所有空白符
static String
difference(String str1, String str2)
Compares two Strings, and returns the portion where they differ.
static String
difference(String str1, String str2)
Compares two Strings, and returns the portion where they differ.
比较两个字符串,返回不同的部分。
static boolean
equals(String str1, String str2)
Compares two Strings, returning true if they are equal.
static boolean
equals(String str1, String str2)
Compares two Strings, returning true if they are equal.
比较两个字符串是否相等。
static boolean
equalsIgnoreCase(String str1, String str2)
Compares two Strings, returning true if they are equal ignoring the case.
static boolean
equalsIgnoreCase(String str1, String str2)
Compares two Strings, returning true if they are equal ignoring the case.
比较两个字符串是否相等,区分大小写。
static String
escape(String str)
Deprecated. Use StringEscapeUtils.escapeJava(String) This method will be removed in Commons Lang 3.0
static String
escape(String str)
Deprecated. Use StringEscapeUtils.escapeJava(String) This method will be removed in Commons Lang 3.0
过时了.在Commons Lang 3.0已经没有此方法了
static String
getChomp(String str, String sep)
Deprecated. Use substringAfterLast(String, String) instead (although this doesn't include the separator) Method will be removed in Commons Lang 3.0.
static String
getChomp(String str, String sep)
Deprecated. Use substringAfterLast(String, String) instead (although this doesn't include the separator) Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static int
getLevenshteinDistance(String s, String t)
Find the Levenshtein distance between two Strings.
static int
getLevenshteinDistance(String s, String t)
Find the Levenshtein distance between two Strings.
计算两个字符串 levenshtein 距离,在计算相似度是用到这个方法
static String
getNestedString(String str, String tag)
Deprecated. Use the better named substringBetween(String, String). Method will be removed in Commons Lang 3.0.
static String
getNestedString(String str, String tag)
Deprecated. Use the better named substringBetween(String, String). Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static String
getNestedString(String str, String open, String close)
Deprecated. Use the better named substringBetween(String, String, String). Method will be removed in Commons Lang 3.0.
static String
getNestedString(String str, String open, String close)
Deprecated. Use the better named substringBetween(String, String, String). Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static String
getPrechomp(String str, String sep)
Deprecated. Use substringBefore(String,String) instead (although this doesn't include the separator). Method will be removed in Commons Lang 3.0.
static String
getPrechomp(String str, String sep)
Deprecated. Use substringBefore(String,String) instead (although this doesn't include the separator). Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static int
indexOf(String str, char searchChar)
Finds the first index within a String, handling null.
static int
indexOf(String str, char searchChar)
Finds the first index within a String, handling null.
返回字符searchChar在字符串str中第一次出现的位置。
如果searchChar没有在str中出现则返回-1,
如果str为null或"",则也返回-1
static int
indexOf(String str, char searchChar, int startPos)
Finds the first index within a String from a start position, handling null.
如果searchChar没有在str中出现则返回-1,
如果str为null或"",则也返回-1
static int
indexOf(String str, char searchChar, int startPos)
Finds the first index within a String from a start position, handling null.
返回字符searchChar从startPos开始在字符串str中第一次出现的位置。
如果从startPos开始searchChar没有在str中出现则返回-1,
如果str为null或"",则也返回-1
static int
indexOf(String str, String searchStr)
Finds the first index within a String, handling null.
如果从startPos开始searchChar没有在str中出现则返回-1,
如果str为null或"",则也返回-1
static int
indexOf(String str, String searchStr)
Finds the first index within a String, handling null.
返回字符串searchStr在字符串str中第一次出现的位置。
如果str为null或searchStr为null则返回-1,
如果searchStr为"",且str为不为null,则返回0,
如果searchStr不在str中,则返回-1
static int
indexOf(String str, String searchStr, int startPos)
Finds the first index within a String, handling null.
如果str为null或searchStr为null则返回-1,
如果searchStr为"",且str为不为null,则返回0,
如果searchStr不在str中,则返回-1
static int
indexOf(String str, String searchStr, int startPos)
Finds the first index within a String, handling null.
返回字符串searchStrr从startPos开始在字符串str中第一次出现的位置。
如果从startPos开始searchStrr没有在str中出现则返回-1,
如果str为null或"",则也返回-1
static int
indexOfAny(String str, char[] searchChars)
Search a String to find the first index of any character in the given set of characters.
如果从startPos开始searchStrr没有在str中出现则返回-1,
如果str为null或"",则也返回-1
static int
indexOfAny(String str, char[] searchChars)
Search a String to find the first index of any character in the given set of characters.
找出字符数组searchChars中的字符第一次出现在字符串str中的位置。
如果字符数组中的字符都不在字符串中,则返回-1
如果字符串为null或"",则返回-1
static int
indexOfAny(String str, String searchChars)
Search a String to find the first index of any character in the given set of characters.
如果字符数组中的字符都不在字符串中,则返回-1
如果字符串为null或"",则返回-1
static int
indexOfAny(String str, String searchChars)
Search a String to find the first index of any character in the given set of characters.
找出字符串searchChars中的字符第一次出现在字符串str中的位置。
如果字符串searchChars中的字符都不在字符串str中,则返回-1
如果searchChars或str为null或为"",则返回-1
static int
indexOfAny(String str, String[] searchStrs)
Find the first index of any of a set of potential substrings.
如果字符串searchChars中的字符都不在字符串str中,则返回-1
如果searchChars或str为null或为"",则返回-1
static int
indexOfAny(String str, String[] searchStrs)
Find the first index of any of a set of potential substrings.
找出字符数组searchStrs中的字符串第一次出现在字符串str中的位置。
如果字符串数组searchStrs中的字符都不在字符串str中,则返回-1
如果searchStrs或str为null或为"",则返回-1
static int
indexOfAnyBut(String str, char[] searchChars)
Search a String to find the first index of any character not in the given set of characters.
如果字符串数组searchStrs中的字符都不在字符串str中,则返回-1
如果searchStrs或str为null或为"",则返回-1
static int
indexOfAnyBut(String str, char[] searchChars)
Search a String to find the first index of any character not in the given set of characters.
找出字符串str中不在字符数组searchChars中的第一个字符的位置。
如果字符串中的所有字符都在字符数组中,则返回-1
如果字符串为null或"",则返回-1
static int
indexOfAnyBut(String str, String searchChars)
Search a String to find the first index of any character not in the given set of characters.
如果字符串中的所有字符都在字符数组中,则返回-1
如果字符串为null或"",则返回-1
static int
indexOfAnyBut(String str, String searchChars)
Search a String to find the first index of any character not in the given set of characters.
找出字符串str中不在字符串searchChars中的第一个字符的位置。
如果字符串str中的所有字符都在字符串searchChars中,则返回-1
如果字符串str或searchChars为null或"",则返回-1
static int
indexOfDifference(String str1, String str2)
Compares two Strings, and returns the index at which the Strings begin to differ.
如果字符串str中的所有字符都在字符串searchChars中,则返回-1
如果字符串str或searchChars为null或"",则返回-1
static int
indexOfDifference(String str1, String str2)
Compares two Strings, and returns the index at which the Strings begin to differ.
比较两个字符串,返回第一次不同的位置。
static boolean
isAlpha(String str)
Checks if the String contains only unicode letters.
static boolean
isAlpha(String str)
Checks if the String contains only unicode letters.
判断Str是否由字母组成。
static boolean
isAlphanumeric(String str)
Checks if the String contains only unicode letters or digits.
static boolean
isAlphanumeric(String str)
Checks if the String contains only unicode letters or digits.
判断Str是否由字母或数字组成。
static boolean
isAlphanumericSpace(String str)
Checks if the String contains only unicode letters, digits or space (' ').
static boolean
isAlphanumericSpace(String str)
Checks if the String contains only unicode letters, digits or space (' ').
判断Str是否由字母、数字或空格组成。
static boolean
isAlphaSpace(String str)
Checks if the String contains only unicode letters and space (' ').
static boolean
isAlphaSpace(String str)
Checks if the String contains only unicode letters and space (' ').
判断Str是否由字母和空格组成。
static boolean
isAsciiPrintable(String str)
Checks if the string contains only ASCII printable characters.
static boolean
isAsciiPrintable(String str)
Checks if the string contains only ASCII printable characters.
判断str是否由ASCII字符组成。
static boolean
isBlank(String str)
Checks if a String is whitespace, empty ("") or null.
static boolean
isBlank(String str)
Checks if a String is whitespace, empty ("") or null.
判断str是否是空格、空字符串或null。
static boolean
isEmpty(String str)
Checks if a String is empty ("") or null.
static boolean
isEmpty(String str)
Checks if a String is empty ("") or null.
判断str是否是空字符串或null。
static boolean
isNotBlank(String str)
Checks if a String is not empty (""), not null and not whitespace only.
static boolean
isNotBlank(String str)
Checks if a String is not empty (""), not null and not whitespace only.
判断str是否不为空且长度不为0且不由空白符(whitespace)构成,
等于!isBlank(String str)
static boolean
isNotEmpty(String str)
Checks if a String is not empty ("") and not null.
等于!isBlank(String str)
static boolean
isNotEmpty(String str)
Checks if a String is not empty ("") and not null.
判断某字符串是否非空,等于!isEmpty(String str)
static boolean
isNumeric(String str)
Checks if the String contains only unicode digits.
static boolean
isNumeric(String str)
Checks if the String contains only unicode digits.
判断字符串str是否有数字组成。
static boolean
isNumericSpace(String str)
Checks if the String contains only unicode digits or space (' ').
static boolean
isNumericSpace(String str)
Checks if the String contains only unicode digits or space (' ').
判断字符串str是否有数字或空字符组成。
static boolean
isWhitespace(String str)
Checks if the String contains only whitespace.
static boolean
isWhitespace(String str)
Checks if the String contains only whitespace.
判断字符串str是否是空格
static String
join(Collection collection, char separator)
Joins the elements of the provided Collection into a single String containing the provided elements.
static String
join(Collection collection, char separator)
Joins the elements of the provided Collection into a single String containing the provided elements.
把collection中的元素通过分隔符separator连接成一个字符串返回。
static String
join(Collection collection, String separator)
Joins the elements of the provided Collection into a single String containing the provided elements.
static String
join(Collection collection, String separator)
Joins the elements of the provided Collection into a single String containing the provided elements.
把collection中的元素通过分隔字符串separator连接成一个字符串返回。
static String
join(Iterator iterator, char separator)
Joins the elements of the provided Iterator into a single String containing the provided elements.
static String
join(Iterator iterator, char separator)
Joins the elements of the provided Iterator into a single String containing the provided elements.
把iterator中的元素通过分隔字符separator连接成一个字符串返回。
static String
join(Iterator iterator, String separator)
Joins the elements of the provided Iterator into a single String containing the provided elements.
static String
join(Iterator iterator, String separator)
Joins the elements of the provided Iterator into a single String containing the provided elements.
把iterator中的元素通过分隔字符串separator连接成一个字符串返回。
static String
join(Object[] array)
Joins the elements of the provided array into a single String containing the provided list of elements.
static String
join(Object[] array)
Joins the elements of the provided array into a single String containing the provided list of elements.
把数组array中的元素连接成一个字符串返回
static String
join(Object[] array, char separator)
Joins the elements of the provided array into a single String containing the provided list of elements.
static String
join(Object[] array, char separator)
Joins the elements of the provided array into a single String containing the provided list of elements.
把数组array中的元素通过分隔符separator连接成一个字符串返回。
static String
join(Object[] array, char separator, int startIndex, int endIndex)
Joins the elements of the provided array into a single String containing the provided list of elements.
static String
join(Object[] array, char separator, int startIndex, int endIndex)
Joins the elements of the provided array into a single String containing the provided list of elements.
把数组array中的元素通过分隔符separator连接成一个字符串返回,连接的开始位置为startIndex,结束位置为endIndex。
static String
join(Object[] array, String separator)
Joins the elements of the provided array into a single String containing the provided list of elements.
static String
join(Object[] array, String separator)
Joins the elements of the provided array into a single String containing the provided list of elements.
把数组array中的元素通过分隔字符串separator连接成一个字符串返回。
static String
join(Object[] array, String separator, int startIndex, int endIndex)
Joins the elements of the provided array into a single String containing the provided list of elements.
static String
join(Object[] array, String separator, int startIndex, int endIndex)
Joins the elements of the provided array into a single String containing the provided list of elements.
把数组array中的元素通过分隔字符串separator连接成一个字符串返回,连接的开始位置为startIndex,结束位置为endIndex。
static int
lastIndexOf(String str, char searchChar)
Finds the last index within a String, handling null.
static int
lastIndexOf(String str, char searchChar)
Finds the last index within a String, handling null.
返回字符searchChar在字符串str中最后一次出现的位置。
如果searchChar没有在str中出现则返回-1,
如果str为null或"",则也返回-1
static int
lastIndexOf(String str, char searchChar, int startPos)
Finds the last index within a String from a start position, handling null.
如果searchChar没有在str中出现则返回-1,
如果str为null或"",则也返回-1
static int
lastIndexOf(String str, char searchChar, int startPos)
Finds the last index within a String from a start position, handling null.
返回字符串searchStrr从startPos开始在字符串str中最后一次出现的位置。
如果从startPos开始searchStrr没有在str中出现则返回-1,
如果str为null或"",则也返回-1
static int
lastIndexOf(String str, String searchStr)
Finds the last index within a String, handling null.
如果从startPos开始searchStrr没有在str中出现则返回-1,
如果str为null或"",则也返回-1
static int
lastIndexOf(String str, String searchStr)
Finds the last index within a String, handling null.
返回字符串searchStr在字符串str中最后一次出现的位置。
如果str为null或searchStr为null则返回-1,
如果searchStr为"",且str为不为null,则返回0,
如果searchStr不在str中,则返回-1
static int
lastIndexOf(String str, String searchStr, int startPos)
Finds the first index within a String, handling null.
如果str为null或searchStr为null则返回-1,
如果searchStr为"",且str为不为null,则返回0,
如果searchStr不在str中,则返回-1
static int
lastIndexOf(String str, String searchStr, int startPos)
Finds the first index within a String, handling null.
返回字符串searchStrr从startPos开始在字符串str中最后一次出现的位置。
如果从startPos开始searchStrr没有在str中出现则返回-1,
如果str为null或"",则也返回-1
static int
lastIndexOfAny(String str, String[] searchStrs)
Find the latest index of any of a set of potential substrings.
如果从startPos开始searchStrr没有在str中出现则返回-1,
如果str为null或"",则也返回-1
static int
lastIndexOfAny(String str, String[] searchStrs)
Find the latest index of any of a set of potential substrings.
找出字符数组searchStrs中的字符串最后一次出现在字符串str中的位置。
如果字符串数组searchStrs中的字符都不在字符串str中,则返回-1
如果searchStrs或str为null或为"",则返回-1
static String
left(String str, int len)
Gets the leftmost len characters of a String.
如果字符串数组searchStrs中的字符都不在字符串str中,则返回-1
如果searchStrs或str为null或为"",则返回-1
static String
left(String str, int len)
Gets the leftmost len characters of a String.
得到字符串str从左边数len长度的子串。
如果str为null或为"",则返回它本身
如果len小于0,则返回""
static String
leftPad(String str, int size)
Left pad a String with spaces (' ').
如果str为null或为"",则返回它本身
如果len小于0,则返回""
static String
leftPad(String str, int size)
Left pad a String with spaces (' ').
如果字符串长度小于size,则在左边补空格使其长度等于size,然后返回
如果字符串长度大于等于size,则返回它本身
如果字符串长度大于等于size,则返回它本身
如果str为null,则返回null
static String
leftPad(String str, int size, char padChar)
Left pad a String with a specified character.
static String
leftPad(String str, int size, char padChar)
Left pad a String with a specified character.
如果字符串长度小于size,则在左边补字符padChar使其长度等于size,然后返回
如果字符串长度大于等于size,则返回它本身
如果字符串长度大于等于size,则返回它本身
如果str为null,则返回null
static String
leftPad(String str, int size, String padStr)
Left pad a String with a specified String.
static String
leftPad(String str, int size, String padStr)
Left pad a String with a specified String.
如果字符串长度小于size,则在左边补字符串padStr使其长度等于size,然后返回
如果字符串长度大于等于size,则返回它本身
如果字符串长度大于等于size,则返回它本身
如果str为null,则返回null
static String
lowerCase(String str)
Converts a String to lower case as per String.toLowerCase().
static String
lowerCase(String str)
Converts a String to lower case as per String.toLowerCase().
字符串str转换为小写。
static String
mid(String str, int pos, int len)
Gets len characters from the middle of a String.
static String
mid(String str, int pos, int len)
Gets len characters from the middle of a String.
得到字符串str从pos开始len长度的子串。
如果str为null或为"",则返回它本身
如果len小于0或pos大于srt的长度,则返回""
如果pos小于0,则pos设为0
static int
ordinalIndexOf(String str, String searchStr, int ordinal)
Finds the n-th index within a String, handling null.
如果str为null或为"",则返回它本身
如果len小于0或pos大于srt的长度,则返回""
如果pos小于0,则pos设为0
static int
ordinalIndexOf(String str, String searchStr, int ordinal)
Finds the n-th index within a String, handling null.
返回字符串searchStr在字符串str中第ordinal次出现的位置。
如果str=null或searchStr=null或ordinal<=0则返回-1
static String
overlay(String str, String overlay, int start, int end)
Overlays part of a String with another String.
如果str=null或searchStr=null或ordinal<=0则返回-1
static String
overlay(String str, String overlay, int start, int end)
Overlays part of a String with another String.
用字符串overlay覆盖字符串str从start到end之间的串。
如果str为null,则返回null
如果start或end小于0,则设为0
如果start大于end,则两者交换
如果start或end大于str的长度,则认为等于str的长度
static String
overlayString(String text, String overlay, int start, int end)
Deprecated. Use better named overlay(String, String, int, int) instead. Method will be removed in Commons Lang 3.0.
如果str为null,则返回null
如果start或end小于0,则设为0
如果start大于end,则两者交换
如果start或end大于str的长度,则认为等于str的长度
static String
overlayString(String text, String overlay, int start, int end)
Deprecated. Use better named overlay(String, String, int, int) instead. Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static String
prechomp(String str, String sep)
Deprecated. Use substringAfter(String,String) instead. Method will be removed in Commons Lang 3.0.
static String
prechomp(String str, String sep)
Deprecated. Use substringAfter(String,String) instead. Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static String
remove(String str, char remove)
Removes all occurances of a character from within the source string.
static String
remove(String str, char remove)
Removes all occurances of a character from within the source string.
去掉字符串str中所有包含字符remove的部分,然后返回
static String
remove(String str, String remove)
Removes all occurances of a substring from within the source string.
static String
remove(String str, String remove)
Removes all occurances of a substring from within the source string.
去掉字符串str中所有包含字符串remove的部分,然后返回
static String
removeEnd(String str, String remove)
Removes a substring only if it is at the end of a source string, otherwise returns the source string.
static String
removeEnd(String str, String remove)
Removes a substring only if it is at the end of a source string, otherwise returns the source string.
如果字符串str是以字符串remove结尾,则去掉这个结尾,然后返回,否则返回原来的串。
static String
removeStart(String str, String remove)
Removes a substring only if it is at the begining of a source string, otherwise returns the source string.
static String
removeStart(String str, String remove)
Removes a substring only if it is at the begining of a source string, otherwise returns the source string.
如果字符串str是以字符串remove开始,则去掉这个开始,然后返回,否则返回原来的串。
static String
repeat(String str, int repeat)
Repeat a String repeat times to form a new String.
static String
repeat(String str, int repeat)
Repeat a String repeat times to form a new String.
重复字符串str repeat次,组合成一个新串返回。
如果字符串str为null或"",则返回它本身
如果repeat小于0,则返回""
static String
replace(String text, String repl, String with)
Replaces all occurrences of a String within another String.
如果字符串str为null或"",则返回它本身
如果repeat小于0,则返回""
static String
replace(String text, String repl, String with)
Replaces all occurrences of a String within another String.
在字符串text中用字符串with代替字符串repl,替换所有。
static String
replace(String text, String repl, String with, int max)
Replaces a String with another String inside a larger String, for the first max values of the search String.
static String
replace(String text, String repl, String with, int max)
Replaces a String with another String inside a larger String, for the first max values of the search String.
在字符串text中用字符串with代替字符串repl,max为最大替换次数。
如果max小于0,则替换所有。
static String
replaceChars(String str, char searchChar, char replaceChar)
Replaces all occurrences of a character in a String with another.
如果max小于0,则替换所有。
static String
replaceChars(String str, char searchChar, char replaceChar)
Replaces all occurrences of a character in a String with another.
在字符串str中用字符replaceChar代替所有字符searchChar,如果字符串为null或"",则返回它本身。
static String
replaceChars(String str, String searchChars, String replaceChars)
Replaces multiple characters in a String in one go.
static String
replaceChars(String str, String searchChars, String replaceChars)
Replaces multiple characters in a String in one go.
用字符串replaceChars替换字符串str中的字符串searchChars。
replaceChars的长度应该和searchChars的长度相等,
如果replaceChars的长度大于searchChars的长度,超过长度的字符将被忽略,
如果replaceChars的长度小于searchChars的长度,超过长度的字符将被删除。
static String
replaceOnce(String text, String repl, String with)
Replaces a String with another String inside a larger String, once.
replaceChars的长度应该和searchChars的长度相等,
如果replaceChars的长度大于searchChars的长度,超过长度的字符将被忽略,
如果replaceChars的长度小于searchChars的长度,超过长度的字符将被删除。
static String
replaceOnce(String text, String repl, String with)
Replaces a String with another String inside a larger String, once.
在字符串text中用字符串with代替repl,仅一次。
static String
reverse(String str)
Reverses a String as per StringBuffer.reverse().
static String
reverse(String str)
Reverses a String as per StringBuffer.reverse().
以字符(单个词)为单位的反转。
static String
reverseDelimited(String str, char separatorChar)
Reverses a String that is delimited by a specific character.
static String
reverseDelimited(String str, char separatorChar)
Reverses a String that is delimited by a specific character.
字符串str单词反向排序,以separatorChar为界限。
static String
reverseDelimitedString(String str, String separatorChars)
Deprecated. Use reverseDelimited(String, char) instead. This method is broken as the join doesn't know which char to use. Method will be removed in Commons Lang 3.0.
static String
reverseDelimitedString(String str, String separatorChars)
Deprecated. Use reverseDelimited(String, char) instead. This method is broken as the join doesn't know which char to use. Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static String
right(String str, int len)
Gets the rightmost len characters of a String.
static String
right(String str, int len)
Gets the rightmost len characters of a String.
得到字符串str从右边数len长度的子串。
如果str为null或为"",则返回它本身
如果len小于0,则返回""
static String
rightPad(String str, int size)
Right pad a String with spaces (' ').
如果str为null或为"",则返回它本身
如果len小于0,则返回""
static String
rightPad(String str, int size)
Right pad a String with spaces (' ').
如果str为null,则返回null
如果字符串长度小于size,则在右边补空格使其长度等于size,然后返回
如果字符串长度大于等于size,则返回它本身
static String
rightPad(String str, int size, char padChar)
Right pad a String with a specified character.
如果字符串长度小于size,则在右边补空格使其长度等于size,然后返回
如果字符串长度大于等于size,则返回它本身
static String
rightPad(String str, int size, char padChar)
Right pad a String with a specified character.
如果str为null,则返回null
如果字符串长度小于size,则在右边补字符padChar使其长度等于size,然后返回
如果字符串长度大于等于size,则返回它本身。
static String
rightPad(String str, int size, String padStr)
Right pad a String with a specified String.
如果字符串长度小于size,则在右边补字符padChar使其长度等于size,然后返回
如果字符串长度大于等于size,则返回它本身。
static String
rightPad(String str, int size, String padStr)
Right pad a String with a specified String.
如果字符串长度小于size,则在右边补字符串padChar使其长度等于size,然后返回
如果字符串长度大于等于size,则返回它本身。
static String[]
split(String str)
Splits the provided text into an array, using whitespace as the separator.
如果字符串长度大于等于size,则返回它本身。
static String[]
split(String str)
Splits the provided text into an array, using whitespace as the separator.
把字符串拆分成一个字符串数组,用空白符(whitespace)作为分隔符。
如果字符串为null,返回null
如果字符串为"",返回空数组{}
static String[]
split(String str, char separatorChar)
Splits the provided text into an array, separator specified.
如果字符串为null,返回null
如果字符串为"",返回空数组{}
static String[]
split(String str, char separatorChar)
Splits the provided text into an array, separator specified.
把字符串拆分成一个字符串数组,用指定的字符separatorChar作为分隔符。
如果字符串为null,返回null
如果字符串为"",返回空数组{}
static String[]
split(String str, String separatorChars)
Splits the provided text into an array, separators specified.
如果字符串为null,返回null
如果字符串为"",返回空数组{}
static String[]
split(String str, String separatorChars)
Splits the provided text into an array, separators specified.
把字符串拆分成一个字符串数组,用指定的字符串separatorChars作为分隔符。
如果字符串str为null,返回null
如果字符串str为"",返回空数组{}
如果separatorChars为null,则默认为空白符
static String[]
split(String str, String separatorChars, int max)
Splits the provided text into an array with a maximum length, separators specified.
如果字符串str为null,返回null
如果字符串str为"",返回空数组{}
如果separatorChars为null,则默认为空白符
static String[]
split(String str, String separatorChars, int max)
Splits the provided text into an array with a maximum length, separators specified.
把字符串拆分成一个字符串数组,用指定的字符串separatorChars作为分隔符,
数组的最大长度为max。
如果字符串str为null,返回null
如果字符串str为"",返回空数组{}
如果separatorChars为null,则默认为空白符
如果max小于等于0,认为是没有限制
static String[]
splitByWholeSeparator(String str, String separator)
Splits the provided text into an array, separator string specified.
数组的最大长度为max。
如果字符串str为null,返回null
如果字符串str为"",返回空数组{}
如果separatorChars为null,则默认为空白符
如果max小于等于0,认为是没有限制
static String[]
splitByWholeSeparator(String str, String separator)
Splits the provided text into an array, separator string specified.
同split(String str, String separatorChars),暂时没有发现区别
static String[]
splitByWholeSeparator(String str, String separator, int max)
Splits the provided text into an array, separator string specified.
static String[]
splitByWholeSeparator(String str, String separator, int max)
Splits the provided text into an array, separator string specified.
同split(String str, String separatorChars, int max),暂时没有发现区别。
static String[]
splitPreserveAllTokens(String str)
Splits the provided text into an array, using whitespace as the separator, preserving all tokens, including empty tokens created by adjacent separators.
static String[]
splitPreserveAllTokens(String str)
Splits the provided text into an array, using whitespace as the separator, preserving all tokens, including empty tokens created by adjacent separators.
把字符串str拆分成一个数组,用空白符(whitespace)作为分隔符,保留所有的标识,
包括相邻分隔符产生的空的标识。它可作为StringTokenizer的一个替代。
static String[]
splitPreserveAllTokens(String str, char separatorChar)
Splits the provided text into an array, separator specified, preserving all tokens, including empty tokens created by adjacent separators.
包括相邻分隔符产生的空的标识。它可作为StringTokenizer的一个替代。
static String[]
splitPreserveAllTokens(String str, char separatorChar)
Splits the provided text into an array, separator specified, preserving all tokens, including empty tokens created by adjacent separators.
把字符串str拆分成一个数组,用字符separatorChar作为分隔符,保留所有的标识,
包括相邻分隔符产生的空的标识。
static String[]
splitPreserveAllTokens(String str, String separatorChars)
Splits the provided text into an array, separators specified, preserving all tokens, including empty tokens created by adjacent separators.
包括相邻分隔符产生的空的标识。
static String[]
splitPreserveAllTokens(String str, String separatorChars)
Splits the provided text into an array, separators specified, preserving all tokens, including empty tokens created by adjacent separators.
把字符串str拆分成一个数组,用字符串separatorChars作为分隔符,保留所有的标识,
包括相邻分隔符产生的空的标识。
static String[]
splitPreserveAllTokens(String str, String separatorChars, int max)
Splits the provided text into an array with a maximum length, separators specified, preserving all tokens, including empty tokens created by adjacent separators.
包括相邻分隔符产生的空的标识。
static String[]
splitPreserveAllTokens(String str, String separatorChars, int max)
Splits the provided text into an array with a maximum length, separators specified, preserving all tokens, including empty tokens created by adjacent separators.
把字符串str拆分成一个数组,用字符串separatorChars作为分隔符,保留所有的标识,
包括相邻分隔符产生的空的标识。数组的最大长度为max。如果max为0或负数,则认为没有限制
static String
strip(String str)
Strips whitespace from the start and end of a String.
包括相邻分隔符产生的空的标识。数组的最大长度为max。如果max为0或负数,则认为没有限制
static String
strip(String str)
Strips whitespace from the start and end of a String.
去掉字符串两端的空白符(whitespace),如果输入为null则返回null
static String
strip(String str, String stripChars)
Strips any of a set of characters from the start and end of a String.
static String
strip(String str, String stripChars)
Strips any of a set of characters from the start and end of a String.
去掉str两端的在stripChars中的字符。如果str为null或等于"",则返回它本身; 如果stripChars为null或"",则返回strip(String str)。
static String[]
stripAll(String[] strs)
Strips whitespace from the start and end of every String in an array.
static String[]
stripAll(String[] strs)
Strips whitespace from the start and end of every String in an array.
对字符串数组中的每个字符串进行strip(String str),然后返回。 如果strs为null或strs长度为0,则返回strs本身
static String[]
stripAll(String[] strs, String stripChars)
Strips any of a set of characters from the start and end of every String in an array.
static String[]
stripAll(String[] strs, String stripChars)
Strips any of a set of characters from the start and end of every String in an array.
对字符串数组中的每个字符串进行strip(String str, String stripChars),然后返回。 如果strs为null或strs长度为0,则返回strs本身
static String
stripEnd(String str, String stripChars)
Strips any of a set of characters from the end of a String.
static String
stripEnd(String str, String stripChars)
Strips any of a set of characters from the end of a String.
去掉str末端的在stripChars中的字符。如果str为null或等于"",则返回它本身; 如果stripChars为null或"",则返回strip(String str)。
static String
stripStart(String str, String stripChars)
Strips any of a set of characters from the start of a String.
static String
stripStart(String str, String stripChars)
Strips any of a set of characters from the start of a String.
去掉str前端的在stripChars中的字符。如果str为null或等于"",则返回它本身; 如果stripChars为null或"",则返回strip(String str)。
static String
stripToEmpty(String str)
Strips whitespace from the start and end of a String returning an empty String if null input.
static String
stripToEmpty(String str)
Strips whitespace from the start and end of a String returning an empty String if null input.
去掉字符串两端的空白符(whitespace), 如果变为null或"",则返回""
static String
stripToNull(String str)
Strips whitespace from the start and end of a String returning null if the String is empty ("") after the strip.
static String
stripToNull(String str)
Strips whitespace from the start and end of a String returning null if the String is empty ("") after the strip.
去掉字符串两端的空白符(whitespace), 如果变为null或"",则返回null
static String
substring(String str, int start)
Gets a substring from the specified String avoiding exceptions.
static String
substring(String str, int start)
Gets a substring from the specified String avoiding exceptions.
得到字符串str的子串。 如果start小于0,位置是从后往前数的第|start|个 如果str为null或"",则返回它本身
static String
substring(String str, int start, int end)
Gets a substring from the specified String avoiding exceptions.
static String
substring(String str, int start, int end)
Gets a substring from the specified String avoiding exceptions.
得到字符串str的子串。 如果start小于0,位置是从后往前数的第|start|个, 如果end小于0,位置是从后往前数的第|end|个, 如果str为null或"",则返回它本身
static String
substringAfter(String str, String separator)
Gets the substring after the first occurrence of a separator.
static String
substringAfter(String str, String separator)
Gets the substring after the first occurrence of a separator.
得到字符串str的在字符串separator出现后的字符串,且separator不包括在内。
如果str为null或为"",则返回它本身
如果separator为null,则返回""
static String
substringAfterLast(String str, String separator)
Gets the substring after the last occurrence of a separator.
如果str为null或为"",则返回它本身
如果separator为null,则返回""
static String
substringAfterLast(String str, String separator)
Gets the substring after the last occurrence of a separator.
得到字符串str的在字符串separator最后一次出现后的字符串,且separator不包括在内。
如果str为null或为"",则返回它本身
如果separator为null,则返回""
static String
substringBefore(String str, String separator)
Gets the substring before the first occurrence of a separator.
如果str为null或为"",则返回它本身
如果separator为null,则返回""
static String
substringBefore(String str, String separator)
Gets the substring before the first occurrence of a separator.
得到字符串str的在字符串separator出现前的字串,且separator不包括在内。
如果str为null或为"",则返回它本身
如果separator为null,则返回str本身
static String
substringBeforeLast(String str, String separator)
Gets the substring before the last occurrence of a separator.
如果str为null或为"",则返回它本身
如果separator为null,则返回str本身
static String
substringBeforeLast(String str, String separator)
Gets the substring before the last occurrence of a separator.
得到字符串str的在字符串separator最后一次出现前的字串,且separator不包括在内。
如果str为null或为"",则返回它本身
如果separator为null,则返回str本身
static String
substringBetween(String str, String tag)
Gets the String that is nested in between two instances of the same String.
如果str为null或为"",则返回它本身
如果separator为null,则返回str本身
static String
substringBetween(String str, String tag)
Gets the String that is nested in between two instances of the same String.
得到str中的在两个字符串tag中间的字符串,即str中的tag所夹的串。
如果str为null或tag为null,返回null
static String
substringBetween(String str, String open, String close)
Gets the String that is nested in between two Strings.
如果str为null或tag为null,返回null
static String
substringBetween(String str, String open, String close)
Gets the String that is nested in between two Strings.
得到str中的在两个字符串open和close中间的字符串,即open和close所夹的串,只返回第一个匹配的结果。
如果str为null或open为null或close为null,返回null
static String[]
substringsBetween(String str, String open, String close)
Searches a String for substrings delimited by a start and end tag, returning all matching substrings in an array.
如果str为null或open为null或close为null,返回null
static String[]
substringsBetween(String str, String open, String close)
Searches a String for substrings delimited by a start and end tag, returning all matching substrings in an array.
得到str中的在两个字符串open和close中间的字符串,即open和close所夹的串,
把所有符合的结果放在数组中返回。
static String
swapCase(String str)
Swaps the case of a String changing upper and title case to lower case, and lower case to upper case.
把所有符合的结果放在数组中返回。
static String
swapCase(String str)
Swaps the case of a String changing upper and title case to lower case, and lower case to upper case.
把字符串中的字符大写转换为小写,小写转换为大写。
static String
trim(String str)
Removes control characters (char <= 32) from both ends of this String, handling null by returning null.
static String
trim(String str)
Removes control characters (char <= 32) from both ends of this String, handling null by returning null.
去掉字符串两端的控制符(control characters, char <= 32)
如果输入为null则返回null
static String
trimToEmpty(String str)
Removes control characters (char <= 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is null.
如果输入为null则返回null
static String
trimToEmpty(String str)
Removes control characters (char <= 32) from both ends of this String returning an empty String ("") if the String is empty ("") after the trim or if it is null.
去掉字符串两端的控制符(control characters, char <= 32) 如果变为null或"",则返回""
static String
trimToNull(String str)
Removes control characters (char <= 32) from both ends of this String returning null if the String is empty ("") after the trim or if it is null.
static String
trimToNull(String str)
Removes control characters (char <= 32) from both ends of this String returning null if the String is empty ("") after the trim or if it is null.
去掉字符串两端的控制符(control characters, char <= 32) 如果变为null或"",则返回null
static String
uncapitalise(String str)
Deprecated. Use the standardly named uncapitalize(String). Method will be removed in Commons Lang 3.0.
static String
uncapitalise(String str)
Deprecated. Use the standardly named uncapitalize(String). Method will be removed in Commons Lang 3.0.
过时了.在Commons Lang 3.0已经没有此方法了
static String
uncapitalize(String str)
Uncapitalizes a String changing the first letter to title case as per Character.toLowerCase(char).
static String
uncapitalize(String str)
Uncapitalizes a String changing the first letter to title case as per Character.toLowerCase(char).
第一个字符小写。
static String
upperCase(String str)
Converts a String to upper case as per String.toUpperCase().
static String
upperCase(String str)
Converts a String to upper case as per String.toUpperCase().
字符串变为大写。
发表评论
-
类的初始化顺序
2010-03-30 09:28 898我们大家都知道,对于静态变量、静态初始化块、变量、初始化块、构 ... -
java static 变量
2010-03-30 09:27 1165有时你希望定义一个类成员,使它的使用完全独立于该类的任何对象。 ... -
Java中的构造器(构造方法)的调用
2010-03-30 09:21 1378注意:(1)在子类中的 ... -
java学习中重写与重载方法的区别
2010-03-30 09:17 1433重写的主要优点是能 ... -
收集到的java 正则验证
2010-01-12 13:02 1109import java.util.regex.*; ... -
MyEclipse 7.0 Milestone-1破解
2010-01-05 15:36 1394import java.io.Buffered ... -
JDK中的URLConnection参数详解
2009-12-25 14:50 9652009年07月10日 16:52 针对JDK中 ... -
java 中int String类型转换
2009-12-15 17:08 1660int -> String int i=12345;S ... -
@suppresswarnings
2009-12-03 12:02 1585about @SuppressWarnings. 关键字: ... -
JDK动态代理的简单使用示例
2009-11-17 10:00 1088JDK动态代理的简单使用示例: 如有业务类:package ... -
CGlib简单介绍
2009-11-17 09:59 1091CGlib概述:cglib(Code Generation L ... -
java(Web)中相对路径,绝对路径问题
2009-11-12 17:23 11301.基本概念的理解 绝对路径:绝对路径就是你的主页上的文件 ... -
J2EE项目异常处理
2009-10-23 16:12 973为什么要在J2EE项目 ... -
Java优化编程--核心类与性能 I/O流
2009-10-23 15:34 1655Java 的I/O流给我的感觉 ... -
URLConnection ,获取互联网资源
2009-10-23 15:32 1032这段代码将向你介绍几个比较常见但需要注意的问题: ... -
Java Exception 处理之最佳实践
2009-10-23 15:31 776本文是Exception处理的一篇不错的文章,从Java Ex ... -
java多线程及线程池小结
2009-10-23 15:29 2709最近在学习线程池的东西,前面有篇文章《线程池的设计原则》, ... -
java 异常Exception
2009-10-22 11:26 1160异常处理是程序设计中 ... -
check exception和uncheck exception
2009-10-22 11:15 6193使用Checked Exception还是UnChecked ... -
java之classloader体系结构(含hotswap)
2009-10-15 15:40 1256jvm classLoader architecture : ...
相关推荐
`StringUtils` API 是 Apache Commons Lang 库中的一个实用工具类,专门为处理 `java.lang.String` 对象提供了丰富的静态方法。这个库是对 Java 标准库中的 `String` 类方法的一个扩展,尤其在处理 `null` 和空白...
### StringUtils API 中文英文对照详解 #### 概述 `org.apache.commons.lang.StringUtils` 是一个在 Java 开发中广泛使用的工具类,它提供了一系列用于处理字符串的方法,这些方法能够安全地处理 `null` 值,并且...
`StringUtils`是Apache Commons Lang库中的一个核心工具类,它提供了大量的静态方法,用于处理字符串。这个库在Java开发中非常常见,因为它弥补了Java标准库中对字符串操作的不足。`StringUtils`类包含了多种实用...
这个"Apache Commons API.rar"压缩包包含五个关键的Apache Commons子项目的API文档,分别是BeanUtils、Lang、Configuration、Logging和Collections。让我们逐一深入了解一下这些API及其提供的功能。 1. **Apache ...
`org.apache.commons.lang.StringUtils` 是 Apache Commons Lang 库中的一个类,提供了对字符串操作的一系列实用方法。这些方法通常比 Java 标准库提供的方法更加强大、灵活,并且能够更好地处理 `null` 值的情况。...
压缩包内的`Apache Commons Lang 3.6 API.CHM`是帮助文档,其中包含了每个类、接口和方法的详细说明,包括参数、返回值、异常和示例代码。这对于开发过程中快速查询和理解API非常有帮助。 `commons-lang3-3.6-...
以下是关于 Apache Commons 中一些关键 API 的详细解释: 1. **Commons Lang**: 提供了对 Java 核心类库的扩展,包括字符串操作、日期和时间处理、系统属性管理、反射工具以及创建枚举的实用方法。例如,`...
Apache Commons Lang 是一个Java工具包,它提供了对Java核心库的补充,特别是在字符串处理、反射、日期和时间操作等方面。`commons-lang3-3.1.jar`是这个库的一个版本,其中包含了多个实用类和方法,有助于简化和...
Apache Commons Lang 是一个Java工具包,它提供了对Java语言核心类库的扩展,以支持一些高级功能和实用方法。这个`org.apache.commons.lang.jar`文件是该库的一个版本,包含了Lang项目的所有包,使得开发者在处理...
Apache Commons Lang是一个非常重要的Java库,它为Java标准类库提供了许多实用的工具类和扩展。这个资源包包含了丰富的功能,极大地增强了Java开发者的生产力。标题中的"org.apache.commons.lang包"指的是该库的主要...
这个压缩包包含了Apache Commons项目的源代码、API文档以及对应的jar包,为开发者提供了一个全面了解和使用Apache Commons组件的资源。 Apache Commons 项目包括多个模块,每个模块专注于特定的功能领域,例如: 1...
这个API包含了`org.apache.commons.lang`包及其子包中的所有组件,为开发者提供了一系列强大的类和方法,使得开发过程更加高效且便捷。在本篇文章中,我们将深入探讨Apache Commons Lang API的核心特性、主要用途...
Apache Commons是Java开发中不可或缺的一部分,它提供了一系列实用的工具类和组件,极大地丰富了Java标准库的功能。这个工具集包含了许多模块,每个模块都专注于特定的编程任务,旨在简化和优化开发流程。以下是一些...
这个API通常指的是Apache Commons项目中的API,这是一个由Apache软件基金会维护的开源项目,旨在为Java开发者提供实用工具类和库。Apache Commons包含了许多子项目,每个子项目专注于特定的编程任务,例如字符串处理...
2. **org.apache.hadoop.fs**: 提供了抽象文件系统的API,定义了对任何支持的文件系统的通用操作,如创建、删除、移动文件和目录。`FileSystem`是这个包的核心类,它允许应用程序以统一的方式访问不同的文件系统。 ...
它包含的类如StringUtils、ArrayUtils、ObjectUtils等,为开发者提供了丰富的API,例如字符串的格式化、数组的复制和转换、对象的比较和判断等。 2.1.1.2 org.apache.commons.lang 这个包是Lang库的核心部分,它...
这个3.4版本的API文档是英文版,为开发者提供了详细的类和方法参考,帮助他们更好地理解和使用这个库。下面将详细介绍Apache Commons Lang 3.4中的主要知识点。 1. **字符串处理**: Apache Commons Lang提供了丰富...
它简化了Java对象属性的设置和获取,提供了属性复制功能,以及对Java反射API的封装。BeanUtils提供了一种简洁的方式来操作JavaBean对象,无需直接调用getter和setter方法。例如,它支持通过字符串表示的属性名进行...
Apache Commons 是一个由Apache软件基金会维护的开源项目,它提供了大量的Java utility类库,极大地丰富了Java的标准库,使得开发者能够更加便捷、高效地进行编程。"org.apache.commons"是这个项目中的一个顶级包,...
Apache Commons Lang是Java编程语言中的一个非常重要的工具包,它为Java API提供了许多有用的扩展和补充。这个包,特别是`com`子包,包含了多种实用工具类,可以帮助开发者更高效地处理日常编程任务。让我们深入了解...