gobeam/stringy

Would really like a "SentenceCase"

nyetwurk opened this issue · 0 comments

Something that converts from CamelCase, snake_case, kebab-case to Sentence case

e.g. ThisIsCamelCase to This is camel case

func (i *input) SentenceCase(rule ...string) StringManipulation {
	input := getInput(*i)
	wordArray := caseHelper(input, false, rule...)
	i.Result = strings.Join(wordArray, " ")
	return i
}

I have code like this but it is pretty ugly (converts to snake case then replaces _ with -):

s := stringy.New(str)
str = strings.ReplaceAll(s.SnakeCase("?", "").ToLower(), "_", " ")
return stringy.New(str).UcFirst()

Also it would be nice to be able to chain ToLower() w/o a new stringy.