Optimized rune counter - much faster than strings.Count for single runes
(s string, r rune)
| 56 | |
| 57 | // Optimized rune counter - much faster than strings.Count for single runes |
| 58 | func countRuneFast(s string, r rune) int { |
| 59 | count := 0 |
| 60 | for _, c := range s { |
| 61 | if c == r { |
| 62 | count++ |
| 63 | } |
| 64 | } |
| 65 | return count |
| 66 | } |
| 67 | |
| 68 | // Analyze all potential separators when common ones don't work |
| 69 | func (sd *sepDetecor) detectBestSeparator(lines []string) rune { |
no outgoing calls