Documentation
¶
Index ¶
- Variables
- func Abbreviate(str, abbrevMarker string, offset, maxWidth int) (string, error)
- func CommonPrefix(strings ...string) string
- func Contains(s string, searchChar string) bool
- func ContainsAnySubstrings(s string, subs []string) bool
- func ContainsIgnoreCase(str, searchStr string) bool
- func DefaultIfBlank(str, defaultStr string) string
- func DefaultIfEmpty(str, defaultStr string) string
- func DeleteWhitespace(str string) string
- func Difference(a, b string) string
- func EndsWith(str, suffix string, ignoreCase bool) bool
- func EndsWithAny(sequence string, searchStrings ...string) bool
- func EndsWithCase(str, suffix string) bool
- func EndsWithIgnoreCase(str, suffix string) bool
- func EqualsAny(str1 string, strings ...string) bool
- func EqualsIgnoreCase(str1, str2 string) bool
- func Index(s, substr string) int
- func IndexAny(s, chars string) int
- func IndexOfDifference(strings ...string) int
- func IndexOfDifferenceWithTwoStr(a, b string) int
- func IsAlpha(s string) bool
- func IsAlphanumeric(s string) bool
- func IsAnyBlank(strings ...string) bool
- func IsAnyEmpty(strings ...string) bool
- func IsBlank(s string) bool
- func IsEmpty(s string) bool
- func IsNoneBlank(strings ...string) bool
- func IsNoneEmpty(strings ...string) bool
- func IsNotBlank(s string) bool
- func IsNotEmpty(s string) bool
- func IsNumeric(s string) bool
- func IsNumerical(s string) bool
- func Left(s string, end int) string
- func Len(str string) int
- func MustReverse(s string) string
- func PadCenterChar(s string, size int, ch Char) string
- func PadCenterSpace(s string, size int) string
- func PadLeftChar(s string, size int, ch Char) string
- func PadLeftSpace(s string, size int) string
- func PadRightChar(s string, size int, ch Char) string
- func PadRightSpace(s string, size int) string
- func RegionMatches(str string, ignoreCase bool, thisStart int, substr string, start int, ...) bool
- func RemoveChar(s string, rmVal Char) string
- func RemoveString(s, rmStr string) string
- func RepeatChar(ch Char, repeat int) string
- func Reverse(s string) (string, error)
- func Right(s string, start int) string
- func Rotate(s string, shift int) string
- func Shuffle(s string) string
- func Sub(s string, start, end int) string
- func Trim(s string, cutSet string) string
- func TrimLeft(str string, stripStr string) string
- func TrimRight(str string, stripStr string) string
- func TrimSpace(s string) string
- type Char
Constants ¶
This section is empty.
Variables ¶
var (
ErrDecodeChar = errors.New("error occurred on char decoding")
)
Functions ¶
func Abbreviate ¶
Abbreviate abbreviates a string using ellipses or another given string.
func CommonPrefix ¶
func ContainsAnySubstrings ¶
ContainsAnySubstrings returns whether s contains any of substring in slice.
func ContainsIgnoreCase ¶
ContainsIgnoreCase checks if string contains a search string irrespective of case.
func DefaultIfBlank ¶
DefaultIfBlank returns default String if str is blank.
func DefaultIfEmpty ¶
DefaultIfEmpty returns default String if str is empty.
func DeleteWhitespace ¶
DeleteWhitespace deletes whitespace.
func Difference ¶
Difference Compares two Strings, and returns the portion where they differ. More precisely, return the remainder of the second String, starting from where it's different from the first. This means that the difference between "abc" and "ab" is the empty String and not "c".
func EndsWithAny ¶
EndsWithAny check if a sequence ends with any of an array of specified strings.
func EndsWithCase ¶
EndsWithCase case-insensitive check if a str ends with a specified suffix.
func EndsWithIgnoreCase ¶
EndsWithIgnoreCase case-insensitive check if a str ends with a specified suffix.
func EqualsIgnoreCase ¶ added in v0.1.2
EqualsIgnoreCase returns true if the two strings are equal ignoring case.
func Index ¶
Index returns the index of the first instance of substr in s, or -1 if substr is not present in s.
func IndexAny ¶
IndexAny returns the index of the first instance of any Unicode code point from chars in s, or -1 if no Unicode code point from chars is present in s.
func IndexOfDifference ¶
IndexOfDifference compares all strings in an array and returns the index at which the
string begin to differ.
func IndexOfDifferenceWithTwoStr ¶
IndexOfDifferenceWithTwoStr Compares two string, and returns the index at which the string begin to differ.
func IsAlphanumeric ¶
IsAlphanumeric checks if the string contains only Unicode letters or digits.
func IsAnyBlank ¶
IsAnyBlank returns true if there is a blank string in strings.
func IsAnyEmpty ¶
IsAnyEmpty returns ture if strings exist empty of string.
func IsBlank ¶
IsBlank returns ture if the string is empty or has a length of 0 or consists of whitespace.
func IsNoneBlank ¶
IsNoneBlank returns true if there is no blank string in strings.
func IsNoneEmpty ¶
IsNoneEmpty returns false if strings exist empty of string.
func IsNotBlank ¶
IsNotBlank returns false if the string is empty or has a length of 0 or consists of whitespace.
func IsNumeric ¶
IsNumeric checks if the string contains only digits. A decimal point is not a digit and returns false.
func Left ¶
Left returns substring from specified string avoiding panics with start. start, end are based on unicode(utf8) count.
func MustReverse ¶
MustReverse reverses a string, panics when error happens.
func PadCenterChar ¶
PadCenterChar center pad a string with a specified character in a larger string(specified size). if the size is less than the param string, the param string is returned. NOTE: size is unicode size.
func PadCenterSpace ¶
PadCenterSpace center pad a string with space character(' ') in a larger string(specified size). if the size is less than the param string, the param string is returned. NOTE: size is unicode size.
func PadLeftChar ¶
PadLeftChar left pad a string with a specified character in a larger string (specified size). if the size is less than the param string, the param string is returned. NOTE: size is unicode size.
func PadLeftSpace ¶
PadLeftSpace left pad a string with space character(' ') in a larger string(specified size). if the size is less than the param string, the param string is returned. NOTE: size is unicode size.
func PadRightChar ¶
PadRightChar right pad a string with a specified character in a larger string(specified size). if the size is less than the param string, the param string is returned. NOTE: size is unicode size.
func PadRightSpace ¶
PadRightSpace right pad a string with space character(' ') in a large string(specified size). if the size is less than the param string, the param string is returned. NOTE: size is unicode size.
func RegionMatches ¶
func RegionMatches(str string, ignoreCase bool, thisStart int, substr string, start int, length int) bool
RegionMatches Green implementation of regionMatches.
func RemoveChar ¶
RemoveChar removes all occurrences of a specified character from the string.
func RemoveString ¶
RemoveString removes all occurrences of a substring from the string.
func RepeatChar ¶
RepeatChar returns padding using the specified delimiter repeated to a given length.
func Right ¶
Right returns substring from specified string avoiding panics with end. start, end are based on unicode(utf8) count.
func Sub ¶
Sub returns substring from specified string avoiding panics with index start and end. start, end are based on unicode(utf8) count.
func Trim ¶
Trim returns a slice of the string s with all leading and trailing Unicode code points contained in cutSet removed.
func TrimLeft ¶
TrimLeft returns a slice of the string s with all leading Unicode code points contained in cutset removed.
To remove a prefix, use TrimPrefix instead.