5 Commits

Author SHA1 Message Date
97809cd321 Merge pull request 'v0.0.8' (#7) from dev into master
Reviewed-on: #7
2026-06-05 03:59:55 +00:00
Timi
801a945991 v0.0.8
All checks were successful
CI/CD / build-deploy (pull_request) Successful in 12s
2026-06-05 11:59:41 +08:00
Timi
112e6290f0 add random text pool 2026-06-05 11:59:35 +08:00
b9d47baa1a Merge pull request 'v0.0.7' (#6) from dev into master
Reviewed-on: #6
2026-06-02 16:11:14 +00:00
Timi
ceb781292d v0.0.7
All checks were successful
CI/CD / build-deploy (pull_request) Successful in 11s
2026-06-03 00:05:40 +08:00
2 changed files with 25 additions and 13 deletions

View File

@@ -6,7 +6,7 @@
<groupId>com.imyeyu.utils</groupId>
<artifactId>timi-utils</artifactId>
<version>0.0.6</version>
<version>0.0.8</version>
<properties>
<maven.test.skip>true</maven.test.skip>

View File

@@ -15,8 +15,16 @@ import java.util.UUID;
*/
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();
/**
* 是否为半角字符
@@ -75,8 +83,8 @@ public class Text {
* @return true 时全部其他字符串和比较字符串一致
*/
public static boolean eqAnd(String string, String... other) {
for (int i = 0; i < other.length; i++) {
if (!string.equals(other[i])) {
for (String s : other) {
if (!string.equals(s)) {
return false;
}
}
@@ -91,8 +99,8 @@ public class Text {
* @return true 时其他字符串存在和比较字符串一致
*/
public static boolean eqOr(String string, String... other) {
for (int i = 0; i < other.length; i++) {
if (!string.equals(other[i])) {
for (String s : other) {
if (!string.equals(s)) {
return false;
}
}
@@ -107,8 +115,8 @@ public class Text {
* @return true 时全部其他字符串和比较字符串一致
*/
public static boolean eqIgnoreCaseAnd(String string, String... other) {
for (int i = 0; i < other.length; i++) {
if (!string.equalsIgnoreCase(other[i])) {
for (String s : other) {
if (!string.equalsIgnoreCase(s)) {
return false;
}
}
@@ -123,8 +131,8 @@ public class Text {
* @return true 时其他字符串存在和比较字符串一致
*/
public static boolean eqIgnoreCaseOr(String string, String... other) {
for (int i = 0; i < other.length; i++) {
if (string.equalsIgnoreCase(other[i])) {
for (String s : other) {
if (string.equalsIgnoreCase(s)) {
return true;
}
}
@@ -141,8 +149,8 @@ public class Text {
public static boolean containsIgnoreCase(String string, String... other) {
String stringUpper = string.toUpperCase();
String stringLower = string.toLowerCase();
for (int i = 0; i < other.length; i++) {
if (stringLower.contains(other[i].toLowerCase()) || stringUpper.contains(other[i].toUpperCase())) {
for (String s : other) {
if (stringLower.contains(s.toLowerCase()) || stringUpper.contains(s.toUpperCase())) {
return true;
}
}
@@ -150,7 +158,7 @@ public class Text {
}
public static String randomString(int length) {
return randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", length);
return randomString(LETTER_NUMBER_POOL, length);
}
public static String randomString(String pool, int length) {
@@ -403,4 +411,8 @@ public class Text {
public static String underscoreClassName(Class<?> clazz) {
return camelCase2underscore(clazz.getSimpleName());
}
public static String bizClassName(Class<?> clazz) {
return underscoreClassName(clazz).toUpperCase();
}
}