strutil

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 4 Imported by: 9

Documentation

Overview

Package strutil implements some functions to manipulate string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After(s, char string) string

After create substring in source string after position when char first appear

func AfterLast

func AfterLast(s, char string) string

AfterLast create substring in source string after position when char last appear

func Before

func Before(s, char string) string

Before create substring in source string before position when char first appear

func BeforeLast

func BeforeLast(s, char string) string

BeforeLast create substring in source string before position when char last appear

func CamelCase

func CamelCase(s string) string

CamelCase covert string to camelCase string.

func Capitalize

func Capitalize(s string) string

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

func KebabCase(s string) string

KebabCase covert string to kebab-case

func LowerFirst

func LowerFirst(s string) string

LowerFirst converts the first character of string to lower case.

func PadEnd

func PadEnd(source string, size int, padStr string) string

PadEnd pads string on the right side if it's shorter than size. Padding characters are truncated if they exceed size.

func PadStart

func PadStart(source string, size int, padStr string) string

PadStart pads string on the left side if it's shorter than size. Padding characters are truncated if they exceed size.

func ReverseStr

func ReverseStr(s string) string

ReverseStr return string whose char order is reversed to the given string

func SnakeCase

func SnakeCase(s string) string

SnakeCase covert string to snake_case

func SplitEx added in v1.3.0

func SplitEx(s, sep string, removeEmptyString bool) []string

SplitEx split a given string whether the result contains empty string

func Unwrap added in v1.1.7

func Unwrap(str string, wrapToken string) string

Unwrap a given string from anther string. will change str value

func UpperFirst added in v1.2.2

func UpperFirst(s string) string

UpperFirst converts the first character of string to upper case.

func Wrap added in v1.1.7

func Wrap(str string, wrapWith string) string

Wrap a string with another string.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL