Added function to generate all case variations of a rune
This commit is contained in:
10
misc.go
10
misc.go
@@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"slices"
|
"slices"
|
||||||
|
"unicode"
|
||||||
)
|
)
|
||||||
|
|
||||||
var whitespaceChars = []rune{' ', '\t', '\n'}
|
var whitespaceChars = []rune{' ', '\t', '\n'}
|
||||||
@@ -111,3 +112,12 @@ func genRange(start, end int) []int {
|
|||||||
}
|
}
|
||||||
return toRet
|
return toRet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns a rune-slice containing all possible cases of the given rune.
|
||||||
|
// At the moment, this includes:
|
||||||
|
// 1. Upper case
|
||||||
|
// 2. Lower case
|
||||||
|
// 3. Title case
|
||||||
|
func allCases(r rune) []rune {
|
||||||
|
return []rune{unicode.ToLower(r), unicode.ToUpper(r), unicode.ToTitle(r)}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user