|
@@ -350,8 +350,9 @@ func AnotherRemoveStart(text []rune) []rune {
|
|
|
removeLength = firstOpposite + 1
|
|
|
nb = nb + removeLength
|
|
|
}
|
|
|
- lastOpposite := pairedIndex[length-1] //最后一个符号
|
|
|
- if lastOpposite > 0 && SymmetricDelete[string(text[length-1])] { //删除结尾由对称符号包括的内容:新城地(区公共厕)所及附属(改造发斯蒂芬)-->新城地(区公共厕)所及附属
|
|
|
+ lastOpposite := pairedIndex[length-1] //最后一个符号
|
|
|
+ lenew := len(text)
|
|
|
+ if lastOpposite > 0 && lenew > 0 && SymmetricDelete[string(text[lenew-1])] { //删除结尾由对称符号包括的内容:新城地(区公共厕)所及附属(改造发斯蒂芬)-->新城地(区公共厕)所及附属
|
|
|
//na = length - lastOpposite
|
|
|
text = text[:lastOpposite-removeLength]
|
|
|
} else if surplusMax == length-1 { //没有对称,只删除最后一个反符号
|
|
@@ -373,7 +374,12 @@ func AnotherRemoveStart(text []rune) []rune {
|
|
|
}
|
|
|
if len(delstrarr) > 0 {
|
|
|
for _, rep := range delstrarr {
|
|
|
- if strings.HasPrefix(rep, string(text[0])) || strings.HasSuffix(rep, string(text[len(text)-1])) { //要清理的内容是开头和结尾部分,清理
|
|
|
+ lenew := len(text)
|
|
|
+ if lenew > 0 && strings.HasPrefix(rep, string(text[0])) { //要清理的内容是开头和结尾部分,清理
|
|
|
+ text = []rune(strings.Replace(string(text), rep, "", -1))
|
|
|
+ }
|
|
|
+ lenew = len(text)
|
|
|
+ if lenew > 0 && strings.HasSuffix(rep, string(text[lenew-1])) {
|
|
|
text = []rune(strings.Replace(string(text), rep, "", -1))
|
|
|
}
|
|
|
}
|