Documentation
¶
Index ¶
- func AnyEmpty(str ...string) bool
- func DefaultIfEmpty(str string, defaultStr string) string
- func Empty(str string) bool
- func NoneEmpty(str ...string) bool
- func NotEmpty(str string) bool
- func ReplaceAll(str string, old string, new string) string
- func Strip(str string, stripChars string) string
- func StripBlank(str string) string
- func StripEnd(str string, stripChars string) string
- func StripStart(str string, stripChars string) string
- func ToBool(str string) bool
- func ToBytes(str string) []byte
- func ToComplex(str string) complex128
- func ToFloat64(str string) float64
- func ToFloat64OrDefault(str string, defVal float64) float64
- func ToInt(str string) int
- func ToIntOrDefault(str string, defVal int) int
- func ToUnit(str string, base int) uint64
- func Trim(str string) string
- type Builder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultIfEmpty ¶
DefaultIfEmpty if the string return the defaultStr
func ReplaceAll ¶
ReplaceAll Replace all old in str with new
func Strip ¶
Strip Delete the characters that start and end with stripChars
- <p>Strips any of a set of characters from the start and end of a String.
- This is similar to {@link String#trim()} but allows the characters
- to be stripped to be controlled.</p> *
- <p>A {@code EmptyStr} input String returns {@code EmptyStr}.
- An empty string ("") input returns the empty string.</p> *
- <p>If the stripChars String is {@code blank}, whitespace is
- stripped as defined by {@link Empty(char)} *
- <pre>
- Strip("", *) = ""
- Strip("abc", "") = "abc"
- Strip(" abc", "") = "abc"
- Strip("abc ", "") = "abc"
- Strip(" abc ", "") = "abc"
- Strip(" abcyx", "xyz") = " abc"
- </pre>
func StripBlank ¶
StripBlank Deletes leading and trailing whitespace characters
- <p>Strips whitespace from the start and end of a String.</p> *
- <p>This is similar to {@link Trim(String)} but removes whitespace.
- Whitespace is defined by {@link Empty(char)}.</p> *
- <pre>
- StripBlank("") = ""
- StripBlank(" ") = ""
- StripBlank("abc") = "abc"
- StripBlank(" abc") = "abc"
- StripBlank("abc ") = "abc"
- StripBlank(" abc ") = "abc"
- StripBlank(" ab c ") = "ab c"
- </pre>
func StripEnd ¶
StripEnd Delete the characters that end with stripChars
- <p>Strips any of a set of characters from the end of a String.</p> *
- <p>A {@code EmptyStr} input String returns {@code EmptyStr}.
- An empty string ("") input returns the empty string.</p> *
- <p>If the stripChars String is {@code EmptyStr}, whitespace is
- stripped as defined by {@link Empty(char)}.</p> *
- <pre>
- StripEnd("", *) = ""
- StripEnd("abc", "") = "abc"
- StripEnd("abc", null) = "abc"
- StripEnd(" abc", null) = " abc"
- StripEnd("abc ", null) = "abc"
- StripEnd(" abc ", null) = " abc"
- StripEnd(" abcyx", "xyz") = " abc"
- StripEnd("120.00", ".0") = "12"
- </pre>
func StripStart ¶
StripStart Delete the characters that start with stripChars
- <p>Strips any of a set of characters from the start of a String.</p> *
- <p>A {@code EmptyStr} input String returns {@code EmptyStr}.
- An empty string ("") input returns the empty string.</p> *
- <p>If the stripChars String is {@code EmptyStr}, whitespace is
- stripped as defined by {@link Empty(char)}.</p> *
- <pre>
- StripStart("", *) = ""
- StripStart("abc", "") = "abc"
- StripStart("abc", "") = "abc"
- StripStart(" abc", "") = "abc"
- StripStart("abc ", "") = "abc "
- StripStart(" abc ", "") = "abc "
- StripStart("yxabc ", "xyz") = "abc "
- </pre>
func ToComplex ¶
func ToComplex(str string) complex128
ToComplex convert string to complex wrap strconv.ParseComplex
func ToFloat64OrDefault ¶ added in v0.0.10
ToFloat64OrDefault convert string to float64, if str empty or err you can get default value tha you want. wrap strconv.ParseFloat
func ToIntOrDefault ¶ added in v0.0.10
ToIntOrDefault convert string int, if str empty or err you can get default value tha you want. wrap strconv.Atoi
Types ¶
Click to show internal directories.
Click to hide internal directories.