1
Fork 0

Simplify string -> runes conversion

This commit is contained in:
stephenmk 2023-02-03 22:07:41 -06:00
parent 70611a51c4
commit a9d85dc720
No known key found for this signature in database
GPG Key ID: B6DA730DB06235F1
1 changed files with 1 additions and 4 deletions

View File

@ -44,10 +44,7 @@ func replaceIterationMarks(text string) string {
// Returns nil if no segmentation is possible.
func makeKanaSegments(kana string) (segments []string) {
hiragana := replaceIterationMarks(katakanaToHiragana(kana))
kanaRunes := []rune{}
for _, kanaRune := range hiragana {
kanaRunes = append(kanaRunes, kanaRune)
}
kanaRunes := []rune(hiragana)
kanaRuneCount := len(kanaRunes)
for i := 0; i < kanaRuneCount; i++ {
for j := 0; j < kanaRuneCount-i; j++ {