Documentation
¶
Overview ¶
Package ystring is yet another collection of helper methods to manipulate UTF-8 encoded strings.
Index ¶
- Constants
- func IsBlank(s string) bool
- func IsEmpty(s string) bool
- func IsNotBlank(s string) bool
- func IsNotEmpty(s string) bool
- func Length(s string) int
- func NotBlankOrDefault(s, fallback string) string
- func NotEmptyOrDefault(s, fallback string) string
- func Shrink(s, sep string) string
- func TrimAfterFirst(s, substr string) string
- func TrimAfterLast(s, substr string) string
- func TrimBeforeFirst(s, substr string) string
- func TrimBeforeLast(s, substr string) string
- func Truncate(s string, n int) string
Constants ¶
const NewLine string = "\n"
Variables ¶
This section is empty.
Functions ¶
func IsNotBlank ¶
IsNotBlank checks if the string contains any non-whitespace characters.
func NotBlankOrDefault ¶
NotBlankOrDefault returns the string if it is not blank, or returns the fallback.
func NotEmptyOrDefault ¶
NotEmptyOrDefault returns the string if it is not empty, or returns the fallback.
func Shrink ¶
Shrink returns a string that replaces consecutive whitespace characters in s with the sep string.
func TrimAfterFirst ¶
TrimAfterFirst returns s without the part after the first instance of substr and that instance itself. If substr is empty or not present in s, s is returned unchanged.
func TrimAfterLast ¶
TrimAfterLast returns s without the part after the last instance of substr and that instance itself. If substr is empty or not present in s, s is returned unchanged.
func TrimBeforeFirst ¶
TrimBeforeFirst returns s without the part before the first instance of substr and that instance itself. If substr is empty or not present in s, s is returned unchanged.
func TrimBeforeLast ¶
TrimBeforeLast returns s without the part before the last instance of substr and that instance itself. If substr is empty or not present in s, s is returned unchanged.
Types ¶
This section is empty.