|
@@ -83,7 +83,7 @@ func RemoveHeadAndEndSymmetricCode(val string) string {
|
|
|
func RemoveStart(i int, text []rune) []rune {
|
|
|
defer qu.Catch()
|
|
|
if len(text) > 0 {
|
|
|
- airedIndex := make(map[int]int)
|
|
|
+ pairedIndex := make(map[int]int)
|
|
|
surplusMax := -1 //记录多余的反符号最大值
|
|
|
positiveMax := -1 //记录多余的正符号最大值
|
|
|
removeLength := 0
|
|
@@ -123,9 +123,9 @@ func RemoveStart(i int, text []rune) []rune {
|
|
|
}
|
|
|
//将成对的符号的index记录,
|
|
|
if index == length-1 {
|
|
|
- airedIndex[index] = nowIndex
|
|
|
+ pairedIndex[index] = nowIndex
|
|
|
}
|
|
|
- airedIndex[nowIndex] = index
|
|
|
+ pairedIndex[nowIndex] = index
|
|
|
}
|
|
|
} else { //正向符号,加入symbolIndex记录索引
|
|
|
tmpArr := []int{}
|
|
@@ -151,12 +151,12 @@ func RemoveStart(i int, text []rune) []rune {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- firstOpposite := airedIndex[0]
|
|
|
+ firstOpposite := pairedIndex[0]
|
|
|
if firstOpposite != 0 {
|
|
|
text = text[firstOpposite+1:]
|
|
|
removeLength = firstOpposite + 1
|
|
|
}
|
|
|
- lastOpposite := airedIndex[length-1]
|
|
|
+ lastOpposite := pairedIndex[length-1]
|
|
|
if lastOpposite > 0 { //有对称的正向符号,删除其中间内容
|
|
|
text = text[:lastOpposite-removeLength]
|
|
|
} else if surplusMax == length-1 { //没有对称,只删除最后一个反符号
|
|
@@ -230,13 +230,13 @@ func OtherClean(field, text string) string {
|
|
|
func AnotherRemoveStart(text []rune) []rune {
|
|
|
defer qu.Catch()
|
|
|
if len(text) > 0 {
|
|
|
- airedIndex := make(map[int]int)
|
|
|
- surplusMax := -1 //记录多余的反符号最大值
|
|
|
- positiveMax := -1 //记录多余的正符号最大值
|
|
|
+ pairedIndex := make(map[int]int)
|
|
|
+ symbolIndex := map[string][]int{} //记录符号和当前索引位置
|
|
|
+ surplusMax := -1 //记录多余的反符号最大值
|
|
|
+ positiveMax := -1 //记录多余的正符号最大值
|
|
|
removeLength := 0
|
|
|
nb := 0
|
|
|
length := len(text)
|
|
|
- symbolIndex := map[string][]int{} //记录符号和当前索引位置
|
|
|
for index, t := range text {
|
|
|
now := AllReg.FindString(string(t))
|
|
|
if len(now) > 0 { //匹配到符号
|
|
@@ -271,9 +271,9 @@ func AnotherRemoveStart(text []rune) []rune {
|
|
|
}
|
|
|
//将成对的符号的index记录,
|
|
|
if index == length-1 {
|
|
|
- airedIndex[index] = nowIndex
|
|
|
+ pairedIndex[index] = nowIndex
|
|
|
}
|
|
|
- airedIndex[nowIndex] = index
|
|
|
+ pairedIndex[nowIndex] = index
|
|
|
}
|
|
|
} else { //正向符号,加入symbolIndex记录索引
|
|
|
tmpArr := []int{}
|
|
@@ -302,14 +302,14 @@ func AnotherRemoveStart(text []rune) []rune {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- firstOpposite := airedIndex[0]
|
|
|
+ firstOpposite := pairedIndex[0]
|
|
|
if firstOpposite != 0 { //第一个正符号对应反符号的位置
|
|
|
text = text[firstOpposite+1:]
|
|
|
removeLength = firstOpposite + 1
|
|
|
nb = nb + removeLength
|
|
|
}
|
|
|
- lastOpposite := airedIndex[length-1] //最后一个符号
|
|
|
- if lastOpposite > 0 { //有对称的正向符号,删除其中间内容
|
|
|
+ lastOpposite := pairedIndex[length-1] //最后一个符号
|
|
|
+ if lastOpposite > 0 { //有对称的正向符号,删除其中间内容
|
|
|
//na = length - lastOpposite
|
|
|
text = text[:lastOpposite-removeLength]
|
|
|
} else if surplusMax == length-1 { //没有对称,只删除最后一个反符号
|