(str string, ind int64)
| 621 | } |
| 622 | |
| 623 | func charAt(str string, ind int64) (string, error) { |
| 624 | i := int(ind) |
| 625 | runes := []rune(str) |
| 626 | if i < 0 || i > len(runes) { |
| 627 | return "", fmt.Errorf("index out of range: %d", ind) |
| 628 | } |
| 629 | if i == len(runes) { |
| 630 | return "", nil |
| 631 | } |
| 632 | return string(runes[i]), nil |
| 633 | } |
| 634 | |
| 635 | func indexOf(str, substr string) (int64, error) { |
| 636 | return indexOfOffset(str, substr, int64(0)) |