diff options
Diffstat (limited to 'internal/comic/helpers.go')
| -rw-r--r-- | internal/comic/helpers.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/comic/helpers.go b/internal/comic/helpers.go index 0458db5..6f5b5a8 100644 --- a/internal/comic/helpers.go +++ b/internal/comic/helpers.go @@ -64,15 +64,16 @@ func distributeParagraphs(paragraphs []string, n int) []string { } func splitByChars(text string, n int) []string { - size := len(text) / n + runes := []rune(text) + size := len(runes) / n sections := make([]string, n) for i := range n { start := i * size end := start + size if i == n-1 { - end = len(text) + end = len(runes) } - sections[i] = strings.TrimSpace(text[start:end]) + sections[i] = strings.TrimSpace(string(runes[start:end])) } return sections } |
