From 356b451b2ad0f3e51eb5473c4d14fdfe3386ac07 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Fri, 30 Jun 2023 14:03:52 +0800
Subject: [PATCH] optimized code

---
 ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/text/Convert.java |   37 +++++++++++++++++--------------------
 1 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/text/Convert.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/text/Convert.java
index aa7c436..de0d127 100644
--- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/text/Convert.java
+++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/text/Convert.java
@@ -313,7 +313,7 @@
      * 转换为Integer数组<br>
      * 
      * @param split 分隔符
-     * @param split 被转换的值
+     * @param str 被转换的值
      * @return 结果
      */
     public static Integer[] toIntArray(String split, String str)
@@ -370,7 +370,7 @@
      * 转换为String数组<br>
      * 
      * @param split 分隔符
-     * @param split 被转换的值
+     * @param str 被转换的值
      * @return 结果
      */
     public static String[] toStrArray(String split, String str)
@@ -561,17 +561,12 @@
         switch (valueStr)
         {
             case "true":
-                return true;
-            case "false":
-                return false;
             case "yes":
-                return true;
             case "ok":
-                return true;
-            case "no":
-                return false;
             case "1":
                 return true;
+            case "false":
+            case "no":
             case "0":
                 return false;
             default:
@@ -717,7 +712,7 @@
         }
         if (value instanceof Double)
         {
-            return new BigDecimal((Double) value);
+            return BigDecimal.valueOf((Double) value);
         }
         if (value instanceof Integer)
         {
@@ -797,16 +792,20 @@
         }
         else if (obj instanceof byte[] || obj instanceof Byte[])
         {
-            if (obj instanceof byte[]){
+            if (obj instanceof byte[])
+            {
                 return str((byte[]) obj, charset);
-            } else {
-                Byte[] bytes = (Byte[])obj;
+            }
+            else
+            {
+                Byte[] bytes = (Byte[]) obj;
                 int length = bytes.length;
                 byte[] dest = new byte[length];
-                for (int i = 0; i < length; i++) {
+                for (int i = 0; i < length; i++)
+                {
                     dest[i] = bytes[i];
                 }
-            return str (dest,charset);
+                return str(dest, charset);
             }
         }
         else if (obj instanceof ByteBuffer)
@@ -903,7 +902,7 @@
      */
     public static String toSBC(String input, Set<Character> notConvertSet)
     {
-        char c[] = input.toCharArray();
+        char[] c = input.toCharArray();
         for (int i = 0; i < c.length; i++)
         {
             if (null != notConvertSet && notConvertSet.contains(c[i]))
@@ -945,7 +944,7 @@
      */
     public static String toDBC(String text, Set<Character> notConvertSet)
     {
-        char c[] = text.toCharArray();
+        char[] c = text.toCharArray();
         for (int i = 0; i < c.length; i++)
         {
             if (null != notConvertSet && notConvertSet.contains(c[i]))
@@ -963,9 +962,7 @@
                 c[i] = (char) (c[i] - 65248);
             }
         }
-        String returnString = new String(c);
-
-        return returnString;
+        return new String(c);
     }
 
     /**

--
Gitblit v1.9.3