Simplify string -> runes conversion
This commit is contained in:
parent
70611a51c4
commit
a9d85dc720
@ -44,10 +44,7 @@ func replaceIterationMarks(text string) string {
|
|||||||
// Returns nil if no segmentation is possible.
|
// Returns nil if no segmentation is possible.
|
||||||
func makeKanaSegments(kana string) (segments []string) {
|
func makeKanaSegments(kana string) (segments []string) {
|
||||||
hiragana := replaceIterationMarks(katakanaToHiragana(kana))
|
hiragana := replaceIterationMarks(katakanaToHiragana(kana))
|
||||||
kanaRunes := []rune{}
|
kanaRunes := []rune(hiragana)
|
||||||
for _, kanaRune := range hiragana {
|
|
||||||
kanaRunes = append(kanaRunes, kanaRune)
|
|
||||||
}
|
|
||||||
kanaRuneCount := len(kanaRunes)
|
kanaRuneCount := len(kanaRunes)
|
||||||
for i := 0; i < kanaRuneCount; i++ {
|
for i := 0; i < kanaRuneCount; i++ {
|
||||||
for j := 0; j < kanaRuneCount-i; j++ {
|
for j := 0; j < kanaRuneCount-i; j++ {
|
||||||
|
Loading…
Reference in New Issue
Block a user