Documentation ¶
Overview ¶
Package strutil implements some functions to manipulate string.
Index ¶
- func After(s, char string) string
- func AfterLast(s, char string) string
- func Before(s, char string) string
- func BeforeLast(s, char string) string
- func CamelCase(s string) string
- func Capitalize(s string) string
- func IsString(v interface{}) bool
- func KebabCase(s string) string
- func LowerFirst(s string) string
- func PadEnd(source string, size int, padStr string) string
- func PadStart(source string, size int, padStr string) string
- func Reverse(s string) string
- func SnakeCase(s string) string
- func SplitEx(s, sep string, removeEmptyString bool) []string
- func Unwrap(str string, wrapToken string) string
- func UpperFirst(s string) string
- func UpperKebabCase(s string) string
- func UpperSnakeCase(s string) string
- func Wrap(str string, wrapWith string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BeforeLast ¶
BeforeLast create substring in source string before position when char last appear
func CamelCase ¶
CamelCase covert string to camelCase string. non letters and numbers will be ignored eg. "Foo-#1😄$_%^&*(1bar" => "foo11Bar"
func Capitalize ¶
Capitalize converts the first character of a string to upper case and the remaining to lower case.
func IsString ¶
func IsString(v interface{}) bool
IsString check if the value data type is string or not.
func KebabCase ¶
KebabCase covert string to kebab-case non letters and numbers will be ignored eg. "Foo-#1😄$_%^&*(1bar" => "foo-1-1-bar"
func LowerFirst ¶
LowerFirst converts the first character of string to lower case.
func PadEnd ¶
PadEnd pads string on the right side if it's shorter than size. Padding characters are truncated if they exceed size.
func PadStart ¶
PadStart pads string on the left side if it's shorter than size. Padding characters are truncated if they exceed size.
func Reverse ¶ added in v1.3.2
Reverse return string whose char order is reversed to the given string
func SnakeCase ¶
SnakeCase covert string to snake_case non letters and numbers will be ignored eg. "Foo-#1😄$_%^&*(1bar" => "foo_1_1_bar"
func SplitEx ¶ added in v1.3.0
SplitEx split a given string whether the result contains empty string
func UpperFirst ¶ added in v1.2.2
UpperFirst converts the first character of string to upper case.
func UpperKebabCase ¶ added in v1.3.5
UpperKebabCase covert string to upper KEBAB-CASE non letters and numbers will be ignored eg. "Foo-#1😄$_%^&*(1bar" => "FOO-1-1-BAR"
func UpperSnakeCase ¶ added in v1.3.5
UpperSnakeCase covert string to upper SNAKE_CASE non letters and numbers will be ignored eg. "Foo-#1😄$_%^&*(1bar" => "FOO_1_1_BAR"
Types ¶
This section is empty.