From 177249c76aeea0b4bf8d8816d4994e3b445b45ce Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期四, 02 九月 2021 10:39:34 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/zzj' into zzj

---
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/StrFormatter.java |   46 ++++++++++++++++------------------------------
 1 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/StrFormatter.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/StrFormatter.java
index 8a8c3aa..ebda6fc 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/StrFormatter.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/StrFormatter.java
@@ -5,8 +5,7 @@
  * 
  * @author ruoyi
  */
-public class StrFormatter
-{
+public class StrFormatter {
     public static final String EMPTY_JSON = "{}";
     public static final char C_BACKSLASH = '\\';
     public static final char C_DELIM_START = '{';
@@ -21,14 +20,14 @@
      * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br>
      * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br>
      * 
-     * @param strPattern 字符串模板
-     * @param argArray 参数列表
+     * @param strPattern
+     *            字符串模板
+     * @param argArray
+     *            参数列表
      * @return 结果
      */
-    public static String format(final String strPattern, final Object... argArray)
-    {
-        if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray))
-        {
+    public static String format(final String strPattern, final Object... argArray) {
+        if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) {
             return strPattern;
         }
         final int strPatternLength = strPattern.length();
@@ -38,43 +37,30 @@
 
         int handledPosition = 0;
         int delimIndex;// 占位符所在位置
-        for (int argIndex = 0; argIndex < argArray.length; argIndex++)
-        {
+        for (int argIndex = 0; argIndex < argArray.length; argIndex++) {
             delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition);
-            if (delimIndex == -1)
-            {
-                if (handledPosition == 0)
-                {
+            if (delimIndex == -1) {
+                if (handledPosition == 0) {
                     return strPattern;
-                }
-                else
-                { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
+                } else { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果
                     sbuf.append(strPattern, handledPosition, strPatternLength);
                     return sbuf.toString();
                 }
-            }
-            else
-            {
-                if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH)
-                {
-                    if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH)
-                    {
+            } else {
+                if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) {
+                    if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) {
                         // 转义符之前还有一个转义符,占位符依旧有效
                         sbuf.append(strPattern, handledPosition, delimIndex - 1);
                         sbuf.append(Convert.utf8Str(argArray[argIndex]));
                         handledPosition = delimIndex + 2;
-                    }
-                    else
-                    {
+                    } else {
                         // 占位符被转义
                         argIndex--;
                         sbuf.append(strPattern, handledPosition, delimIndex - 1);
                         sbuf.append(C_DELIM_START);
                         handledPosition = delimIndex + 1;
                     }
-                }
-                else
-                {
+                } else {
                     // 正常占位符
                     sbuf.append(strPattern, handledPosition, delimIndex);
                     sbuf.append(Convert.utf8Str(argArray[argIndex]));

--
Gitblit v1.7.1