deason 10 月之前
父节点
当前提交
4dc6f4579f
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      examcloud-support/src/main/java/cn/com/qmth/examcloud/commons/util/StringUtil.java

+ 7 - 0
examcloud-support/src/main/java/cn/com/qmth/examcloud/commons/util/StringUtil.java

@@ -89,6 +89,13 @@ public class StringUtil {
 
     }
 
+    public static String substring(String str, int maxLength) {
+        if (StringUtils.length(str) > maxLength) {
+            return str.substring(0, maxLength);
+        }
+        return str;
+    }
+
     /**
      * @param in
      * @return