Added function to generate all case variations of a rune

master
Aadhavan Srinivasan 4 weeks ago
parent c87a4b7136
commit ee02e7575e

@ -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)}
}

Loading…
Cancel
Save