(str string, begin, end int)
| 189 | } |
| 190 | |
| 191 | func subString(str string, begin, end int) string { |
| 192 | rs := []rune(str) |
| 193 | length := len(rs) |
| 194 | if begin < 0 { |
| 195 | begin = 0 |
| 196 | } |
| 197 | if begin >= length { |
| 198 | return "" |
| 199 | } |
| 200 | if end == -1 || end > length { |
| 201 | return string(rs[begin:]) |
| 202 | } |
| 203 | return string(rs[begin:end]) |
| 204 | } |