Package org.ximinghui.common.util
Class Characters
java.lang.Object
org.apache.commons.lang3.CharUtils
org.ximinghui.common.util.Characters
public class Characters
extends org.apache.commons.lang3.CharUtils
字符工具类
- Since:
- Common Util 3.12.0.1
- Author:
- Xi Minghui
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Character连字符static final Character空格static final Character下划线Fields inherited from class org.apache.commons.lang3.CharUtils
CR, LF, NUL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsAnyAlphabet(char... chars) 判断字符是否存在任意英文字母static booleancontainsAnyEnglishAlphabet(char... chars) 判断字符是否存在任意英文字母static booleancontainsAnyLowerAlphabet(char... chars) 判断字符是否存在任意小写英文字母static booleancontainsAnyLowerEnglishAlphabet(char... chars) 判断字符是否存在任意小写英文字母static booleancontainsAnyNotAlphabet(char... chars) 判断字符是否存在任意非英文字母static booleancontainsAnyNotEnglishAlphabet(char... chars) 判断字符是否存在任意非英文字母static booleancontainsAnyNotLowerAlphabet(char... chars) 判断字符是否存在任意非小写英文字母static booleancontainsAnyNotLowerEnglishAlphabet(char... chars) 判断字符是否存在任意非小写英文字母static booleancontainsAnyNotUpperAlphabet(char... chars) 判断字符是否存在任意非大写英文字母static booleancontainsAnyNotUpperEnglishAlphabet(char... chars) 判断字符是否存在任意非大写英文字母static booleancontainsAnyUpperAlphabet(char... chars) 判断字符是否存在任意大写英文字母static booleancontainsAnyUpperEnglishAlphabet(char... chars) 判断字符是否存在任意大写英文字母static booleanisAllAlphabets(char... chars) 判断字符是否都为英文字母static booleanisAllEnglishAlphabets(char... chars) 判断字符是否都为英文字母static booleanisAllLowerAlphabets(char... chars) 判断字符是否都为小写英文字母static booleanisAllLowerEnglishAlphabets(char... chars) 判断字符是否都为小写英文字母static booleanisAllNotAlphabets(char... chars) 判断字符是否都非英文字母static booleanisAllNotEnglishAlphabets(char... chars) 判断字符是否都非英文字母static booleanisAllNotLowerAlphabets(char... chars) 判断字符是否都非小写英文字母static booleanisAllNotLowerEnglishAlphabets(char... chars) 判断字符是否都非小写英文字母static booleanisAllNotUpperAlphabets(char... chars) 判断字符是否都非大写英文字母static booleanisAllNotUpperEnglishAlphabets(char... chars) 判断字符是否都非大写英文字母static booleanisAllUpperAlphabets(char... chars) 判断字符是否都为大写英文字母static booleanisAllUpperEnglishAlphabets(char... chars) 判断字符是否都为大写英文字母static booleanisAlphabet(char c) 判断字符是否为英文字母static boolean判断给定字符是否为数字static booleanisEnglishAlphabet(char c) 判断字符是否为英文字母 一些示例 待判断字符判断结果 atrue btrue Ctrue Dtrue 锟false 斤false 拷false 1false 2false 3falsestatic booleanisLowerAlphabet(char c) 判断字符是否为小写英文字母static booleanisLowerEnglishAlphabet(char c) 判断字符是否为小写英文字母 一些示例 待判断字符判断结果 atrue btrue Cfalse Dfalse 锟false 斤false 拷false 1false 2false 3falsestatic booleanisNotAlphabet(char c) 判断字符是否英文字母static booleanisNotEnglishAlphabet(char c) 判断字符是否非英文字母static booleanisNotLowerAlphabet(char c) 判断字符是否非小写英文字母static booleanisNotLowerEnglishAlphabet(char c) 判断字符是否非小写英文字母static booleanisNotUpperAlphabet(char c) 判断字符是否非大写英文字母static booleanisNotUpperEnglishAlphabet(char c) 判断字符是否非大写英文字母static booleanisUpperAlphabet(char c) 判断字符是否为大写英文字母static booleanisUpperEnglishAlphabet(char c) 判断字符是否为大写英文字母 一些示例 待判断字符判断结果 afalse bfalse Ctrue Dtrue 锟false 斤false 拷false 1false 2false 3falsestatic Character生成一个随机数字字符static Character从给定字符集中随机获取一个非控制字符static CharacterrandomVisibleChar(Characters.CharacterSet charSet) 从给定字符集中随机获取一个可见字符Methods inherited from class org.apache.commons.lang3.CharUtils
compare, isAscii, isAsciiAlpha, isAsciiAlphaLower, isAsciiAlphanumeric, isAsciiAlphaUpper, isAsciiControl, isAsciiNumeric, isAsciiPrintable, toChar, toChar, toChar, toChar, toCharacterObject, toCharacterObject, toIntValue, toIntValue, toIntValue, toIntValue, toString, toString, unicodeEscaped, unicodeEscaped
-
Field Details
-
SPACE
空格 -
UNDERSCORE
下划线 -
HYPHEN
连字符
-
-
Constructor Details
-
Characters
public Characters()
-
-
Method Details
-
isDigit
判断给定字符是否为数字- Parameters:
character- 待判断字符- Returns:
- 当给定字符为0~9的数字字符时返回true,否则返回false
- Since:
- Common Util 3.12.0.8
-
isAlphabet
public static boolean isAlphabet(char c) 判断字符是否为英文字母- Parameters:
c- 待判断字符- Returns:
- 当待判断字符为26个英文字母之一时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isAllAlphabets
public static boolean isAllAlphabets(char... chars) 判断字符是否都为英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符都为英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
containsAnyAlphabet
public static boolean containsAnyAlphabet(char... chars) 判断字符是否存在任意英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符中存在任何英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isNotAlphabet
public static boolean isNotAlphabet(char c) 判断字符是否英文字母- Parameters:
c- 待判断字符- Returns:
- 当待判断字符非26个英文字母之一时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isAllNotAlphabets
public static boolean isAllNotAlphabets(char... chars) 判断字符是否都非英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符都非英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
containsAnyNotAlphabet
public static boolean containsAnyNotAlphabet(char... chars) 判断字符是否存在任意非英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符中存在任何非英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isUpperAlphabet
public static boolean isUpperAlphabet(char c) 判断字符是否为大写英文字母- Parameters:
c- 待判断字符- Returns:
- 当待判断字符为大写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isAllUpperAlphabets
public static boolean isAllUpperAlphabets(char... chars) 判断字符是否都为大写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符都为大写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
containsAnyUpperAlphabet
public static boolean containsAnyUpperAlphabet(char... chars) 判断字符是否存在任意大写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符中存在任何大写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isNotUpperAlphabet
public static boolean isNotUpperAlphabet(char c) 判断字符是否非大写英文字母- Parameters:
c- 待判断字符- Returns:
- 当待判断字符非大写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isAllNotUpperAlphabets
public static boolean isAllNotUpperAlphabets(char... chars) 判断字符是否都非大写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符都非大写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
containsAnyNotUpperAlphabet
public static boolean containsAnyNotUpperAlphabet(char... chars) 判断字符是否存在任意非大写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符中存在任何非大写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isLowerAlphabet
public static boolean isLowerAlphabet(char c) 判断字符是否为小写英文字母- Parameters:
c- 待判断字符- Returns:
- 当待判断字符为小写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isAllLowerAlphabets
public static boolean isAllLowerAlphabets(char... chars) 判断字符是否都为小写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符都为小写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
containsAnyLowerAlphabet
public static boolean containsAnyLowerAlphabet(char... chars) 判断字符是否存在任意小写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符在存在任何小写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isNotLowerAlphabet
public static boolean isNotLowerAlphabet(char c) 判断字符是否非小写英文字母- Parameters:
c- 待判断字符- Returns:
- 当待判断字符非小写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isAllNotLowerAlphabets
public static boolean isAllNotLowerAlphabets(char... chars) 判断字符是否都非小写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符都非小写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
containsAnyNotLowerAlphabet
public static boolean containsAnyNotLowerAlphabet(char... chars) 判断字符是否存在任意非小写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符中存在任何非小写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isEnglishAlphabet
public static boolean isEnglishAlphabet(char c) 判断字符是否为英文字母一些示例 待判断字符 判断结果 a true b true C true D true 锟 false 斤 false 拷 false 1 false 2 false 3 false - Parameters:
c- 待判断字符- Returns:
- 当待判断字符为26个英文字母之一时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
-
isAllEnglishAlphabets
public static boolean isAllEnglishAlphabets(char... chars) 判断字符是否都为英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符都为英文字母时返回true,否则有任意一个字符非英文字母都将返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
containsAnyEnglishAlphabet
public static boolean containsAnyEnglishAlphabet(char... chars) 判断字符是否存在任意英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符中存在任何英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isNotEnglishAlphabet
public static boolean isNotEnglishAlphabet(char c) 判断字符是否非英文字母isEnglishAlphabet(char)方法的取反
- Parameters:
c- 待判断字符- Returns:
- 当待判断字符非26个英文字母之一时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isAllNotEnglishAlphabets
public static boolean isAllNotEnglishAlphabets(char... chars) 判断字符是否都非英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符都非英文字母时返回true,否则有任意一个字符为英文字母都将返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
containsAnyNotEnglishAlphabet
public static boolean containsAnyNotEnglishAlphabet(char... chars) 判断字符是否存在任意非英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符中存在任何非英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isUpperEnglishAlphabet
public static boolean isUpperEnglishAlphabet(char c) 判断字符是否为大写英文字母一些示例 待判断字符 判断结果 a false b false C true D true 锟 false 斤 false 拷 false 1 false 2 false 3 false - Parameters:
c- 待判断字符- Returns:
- 当待判断字符为大写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
-
isAllUpperEnglishAlphabets
public static boolean isAllUpperEnglishAlphabets(char... chars) 判断字符是否都为大写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符都为大写英文字母时返回true,否则有任意一个字符非大写英文字母都将返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
containsAnyUpperEnglishAlphabet
public static boolean containsAnyUpperEnglishAlphabet(char... chars) 判断字符是否存在任意大写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符中存在任何大写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isNotUpperEnglishAlphabet
public static boolean isNotUpperEnglishAlphabet(char c) 判断字符是否非大写英文字母isUpperAlphabet(char)方法的取反
- Parameters:
c- 待判断字符- Returns:
- 当待判断字符非大写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isAllNotUpperEnglishAlphabets
public static boolean isAllNotUpperEnglishAlphabets(char... chars) 判断字符是否都非大写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符都非大写英文字母时返回true,否则有任意一个字符为大写英文字母都将返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
containsAnyNotUpperEnglishAlphabet
public static boolean containsAnyNotUpperEnglishAlphabet(char... chars) 判断字符是否存在任意非大写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符中存在任何非大写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isLowerEnglishAlphabet
public static boolean isLowerEnglishAlphabet(char c) 判断字符是否为小写英文字母一些示例 待判断字符 判断结果 a true b true C false D false 锟 false 斤 false 拷 false 1 false 2 false 3 false - Parameters:
c- 待判断字符- Returns:
- 当待判断字符为小写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
-
isAllLowerEnglishAlphabets
public static boolean isAllLowerEnglishAlphabets(char... chars) 判断字符是否都为小写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符都为小写英文字母时返回true,否则有任意一个字符非小写英文字母都将返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
containsAnyLowerEnglishAlphabet
public static boolean containsAnyLowerEnglishAlphabet(char... chars) 判断字符是否存在任意小写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符中存在任何小写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isNotLowerEnglishAlphabet
public static boolean isNotLowerEnglishAlphabet(char c) 判断字符是否非小写英文字母isLowerAlphabet(char)方法的取反
- Parameters:
c- 待判断字符- Returns:
- 当待判断字符非小写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
isAllNotLowerEnglishAlphabets
public static boolean isAllNotLowerEnglishAlphabets(char... chars) 判断字符是否都非小写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符都非小写英文字母时返回true,否则有任意一个字符为小写英文字母都将返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
containsAnyNotLowerEnglishAlphabet
public static boolean containsAnyNotLowerEnglishAlphabet(char... chars) 判断字符是否存在任意非小写英文字母- Parameters:
chars- 待判断字符数组- Returns:
- 当待判断字符中存在任何非小写英文字母时返回true,否则返回false
- Since:
- Common Util 3.12.0.9
- See Also:
-
randomNonControlChar
从给定字符集中随机获取一个非控制字符- Parameters:
charSet- 字符集- Returns:
- 随机非控制字符
- Since:
- Common Util 3.12.0.1
-
randomVisibleChar
从给定字符集中随机获取一个可见字符与
randomNonControlChar(Characters.CharacterSet)方法不同的是,该方法不 会生成包含空白字符(如空格)。- Parameters:
charSet- 字符集- Returns:
- 随机可见字符
- Since:
- Common Util 3.12.0.1
-
randomDigitChar
生成一个随机数字字符- Returns:
- 随机数字字符
- Since:
- Common Util 3.12.0.5
-