Compare commits
5 Commits
801a945991
...
v0.0.6
| Author | SHA1 | Date | |
|---|---|---|---|
| a4bcc3bf57 | |||
| 6361c70f37 | |||
| e793a260be | |||
| 2020cb9111 | |||
| b686679014 |
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.imyeyu.utils</groupId>
|
<groupId>com.imyeyu.utils</groupId>
|
||||||
<artifactId>timi-utils</artifactId>
|
<artifactId>timi-utils</artifactId>
|
||||||
<version>0.0.8</version>
|
<version>0.0.6</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.test.skip>true</maven.test.skip>
|
<maven.test.skip>true</maven.test.skip>
|
||||||
|
|||||||
@@ -15,16 +15,8 @@ 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 = (NUMBER_POOL + "abcdef").toCharArray();
|
public static char[] HEX_DIGITS_LOWER = "0123456789abcdef".toCharArray();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为半角字符
|
* 是否为半角字符
|
||||||
@@ -83,8 +75,8 @@ public class Text {
|
|||||||
* @return true 时全部其他字符串和比较字符串一致
|
* @return true 时全部其他字符串和比较字符串一致
|
||||||
*/
|
*/
|
||||||
public static boolean eqAnd(String string, String... other) {
|
public static boolean eqAnd(String string, String... other) {
|
||||||
for (String s : other) {
|
for (int i = 0; i < other.length; i++) {
|
||||||
if (!string.equals(s)) {
|
if (!string.equals(other[i])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,8 +91,8 @@ public class Text {
|
|||||||
* @return true 时其他字符串存在和比较字符串一致
|
* @return true 时其他字符串存在和比较字符串一致
|
||||||
*/
|
*/
|
||||||
public static boolean eqOr(String string, String... other) {
|
public static boolean eqOr(String string, String... other) {
|
||||||
for (String s : other) {
|
for (int i = 0; i < other.length; i++) {
|
||||||
if (!string.equals(s)) {
|
if (!string.equals(other[i])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,8 +107,8 @@ public class Text {
|
|||||||
* @return true 时全部其他字符串和比较字符串一致
|
* @return true 时全部其他字符串和比较字符串一致
|
||||||
*/
|
*/
|
||||||
public static boolean eqIgnoreCaseAnd(String string, String... other) {
|
public static boolean eqIgnoreCaseAnd(String string, String... other) {
|
||||||
for (String s : other) {
|
for (int i = 0; i < other.length; i++) {
|
||||||
if (!string.equalsIgnoreCase(s)) {
|
if (!string.equalsIgnoreCase(other[i])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,8 +123,8 @@ public class Text {
|
|||||||
* @return true 时其他字符串存在和比较字符串一致
|
* @return true 时其他字符串存在和比较字符串一致
|
||||||
*/
|
*/
|
||||||
public static boolean eqIgnoreCaseOr(String string, String... other) {
|
public static boolean eqIgnoreCaseOr(String string, String... other) {
|
||||||
for (String s : other) {
|
for (int i = 0; i < other.length; i++) {
|
||||||
if (string.equalsIgnoreCase(s)) {
|
if (string.equalsIgnoreCase(other[i])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,8 +141,8 @@ public class Text {
|
|||||||
public static boolean containsIgnoreCase(String string, String... other) {
|
public static boolean containsIgnoreCase(String string, String... other) {
|
||||||
String stringUpper = string.toUpperCase();
|
String stringUpper = string.toUpperCase();
|
||||||
String stringLower = string.toLowerCase();
|
String stringLower = string.toLowerCase();
|
||||||
for (String s : other) {
|
for (int i = 0; i < other.length; i++) {
|
||||||
if (stringLower.contains(s.toLowerCase()) || stringUpper.contains(s.toUpperCase())) {
|
if (stringLower.contains(other[i].toLowerCase()) || stringUpper.contains(other[i].toUpperCase())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -158,7 +150,7 @@ public class Text {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String randomString(int length) {
|
public static String randomString(int length) {
|
||||||
return randomString(LETTER_NUMBER_POOL, length);
|
return randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String randomString(String pool, int length) {
|
public static String randomString(String pool, int length) {
|
||||||
@@ -411,8 +403,4 @@ public class Text {
|
|||||||
public static String underscoreClassName(Class<?> clazz) {
|
public static String underscoreClassName(Class<?> clazz) {
|
||||||
return camelCase2underscore(clazz.getSimpleName());
|
return camelCase2underscore(clazz.getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String bizClassName(Class<?> clazz) {
|
|
||||||
return underscoreClassName(clazz).toUpperCase();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user