mirror of https://github.com/gobeam/stringy.git
parent
9dd1f5ca32
commit
82896f05d5
|
@ -7,10 +7,11 @@ import (
|
||||||
"unicode"
|
"unicode"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var selectCapitalRegexp = regexp.MustCompile(SelectCapital)
|
||||||
|
|
||||||
func caseHelper(input string, isCamel bool, rule ...string) []string {
|
func caseHelper(input string, isCamel bool, rule ...string) []string {
|
||||||
if !isCamel {
|
if !isCamel {
|
||||||
re := regexp.MustCompile(SelectCapital)
|
input = selectCapitalRegexp.ReplaceAllString(input, ReplaceCapital)
|
||||||
input = re.ReplaceAllString(input, ReplaceCapital)
|
|
||||||
}
|
}
|
||||||
input = strings.Join(strings.Fields(strings.TrimSpace(input)), " ")
|
input = strings.Join(strings.Fields(strings.TrimSpace(input)), " ")
|
||||||
if len(rule) > 0 && len(rule)%2 != 0 {
|
if len(rule) > 0 && len(rule)%2 != 0 {
|
||||||
|
|
Loading…
Reference in New Issue