🏗️ microservice fabric splitting

This commit is contained in:
2024-12-24 00:38:41 +08:00
parent 462e811742
commit 89d64336f5
311 changed files with 18384 additions and 2428 deletions

View File

@@ -0,0 +1,21 @@
package utils
import (
"regexp"
"strings"
)
func RemoveZeroAndAdjust(s string) string {
// 正则表达式匹配 "|0|" 或 "|0" 或 "0|" 并替换为 "|"
re := regexp.MustCompile(`(\|0|0\||0)`)
result := re.ReplaceAllString(s, "|")
// 移除可能出现的连续 "|"
re = regexp.MustCompile(`\|+`)
result = re.ReplaceAllString(result, "|")
// 移除字符串开头和结尾可能出现的 "|"
result = strings.Trim(result, "|")
return result
}