EqualStrings 检查两个字符串slice内容是否一致
(s1 []string, s2 []string)
| 44 | |
| 45 | // EqualStrings 检查两个字符串slice内容是否一致 |
| 46 | func EqualStrings(s1 []string, s2 []string) bool { |
| 47 | if len(s1) != len(s2) { |
| 48 | return false |
| 49 | } |
| 50 | sort.Strings(s1) |
| 51 | sort.Strings(s2) |
| 52 | for index, v1 := range s1 { |
| 53 | if v1 != s2[index] { |
| 54 | return false |
| 55 | } |
| 56 | } |
| 57 | return true |
| 58 | } |
| 59 | |
| 60 | // CutPrefix returns s without the provided leading prefix string |
| 61 | // and reports whether it found the prefix. |
no outgoing calls