** * 数组去重 去空 */
(a []string)
| 93 | * 数组去重 去空 |
| 94 | */ |
| 95 | func RemoveDuplicatesAndEmpty(a []string) (ret []string) { |
| 96 | a_len := len(a) |
| 97 | for i := 0; i < a_len; i++ { |
| 98 | if (i > 0 && a[i-1] == a[i]) || len(a[i]) == 0 { |
| 99 | continue |
| 100 | } |
| 101 | ret = append(ret, a[i]) |
| 102 | } |
| 103 | return |
| 104 | } |