add random text pool
This commit is contained in:
@@ -15,8 +15,16 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
public class Text {
|
public class Text {
|
||||||
|
|
||||||
|
public static String LETTER_POOL = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
|
public static String NUMBER_POOL = "0123456789";
|
||||||
|
|
||||||
|
public static String LETTER_NUMBER_POOL = LETTER_POOL + LETTER_POOL;
|
||||||
|
|
||||||
|
public static String PASSWORD_CHAR_POOL = LETTER_NUMBER_POOL + "!#$%&()*+,-./:;<=>?@[]^_`{|}~";
|
||||||
|
|
||||||
/** 十六进制小写 */
|
/** 十六进制小写 */
|
||||||
public static char[] HEX_DIGITS_LOWER = "0123456789abcdef".toCharArray();
|
public static char[] HEX_DIGITS_LOWER = (NUMBER_POOL + "abcdef").toCharArray();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为半角字符
|
* 是否为半角字符
|
||||||
@@ -150,7 +158,7 @@ public class Text {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String randomString(int length) {
|
public static String randomString(int length) {
|
||||||
return randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", length);
|
return randomString(LETTER_NUMBER_POOL, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String randomString(String pool, int length) {
|
public static String randomString(String pool, int length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user