From c313a253b1fcdc75b6be5db575fc2b29fb407021 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期三, 15 四月 2026 20:05:04 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 server/services/src/main/java/com/doumee/core/utils/Strings.java |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/server/services/src/main/java/com/doumee/core/utils/Strings.java b/server/services/src/main/java/com/doumee/core/utils/Strings.java
new file mode 100644
index 0000000..9ae0196
--- /dev/null
+++ b/server/services/src/main/java/com/doumee/core/utils/Strings.java
@@ -0,0 +1,55 @@
+package com.doumee.core.utils;
+
+
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.security.SecureRandom;
+import java.util.Random;
+
+/**
+ * A null-safe utility to handle the String instances.
+ *
+ * @author Guang YANG
+ * @version 1.1
+ */
+public final class Strings {
+
+    public static final String EMPTY = "";
+    public static final String INSTANTIATION_PROHIBITED = "Instantiation prohibited.";
+    private static final Logger LOGGER = LoggerFactory.getLogger(Strings.class);
+
+    private Strings() {
+        throw new AssertionError(INSTANTIATION_PROHIBITED);
+    }
+
+    /**
+     * Generate random string with alpha and numeric of given length.
+     */
+    public static String randomAlphanumeric(int length) {
+        return new RandomString(length).nextString();
+    }
+
+    public static String randomNumeric(int length) {
+        return new RandomString(length, new SecureRandom(), "0123456789").nextString();
+    }
+
+    public static String getRandomNumberString(Integer strLength) {
+
+        Random rnd = new Random();
+
+        String str = "9999";
+
+        if(strLength >= str.length()){
+            str = StringUtils.leftPad(str,strLength,"9");
+        }
+
+        int number = rnd.nextInt(Integer.parseInt(str));
+
+        return String.format("%06d", number);
+
+    }
+
+
+}

--
Gitblit v1.9.3