Documentation
¶
Index ¶
- func After(subject, search string) string
- func AfterLast(subject, search string) string
- func Ascii(value string) string
- func Before(subject, search string) string
- func BeforeLast(subject, search string) string
- func Between(subject, from, to string) string
- func BetweenFirst(subject, from, to string) string
- func Camel(value string) string
- func Contains(haystack string, needles ...string) bool
- func ContainsAll(haystack string, needles []string) bool
- func EndsWith(haystack string, needles ...string) bool
- func Exactly(subject, value string) bool
- func Excerpt(text, phrase string, options ...ExcerptOptions) string
- func Finish(value, cap string) string
- func Headline(value string) string
- func InlineMarkdown(str string) string
- func Is(pattern, value string) bool
- func IsAscii(value string) bool
- func IsJson(value string) bool
- func IsUlid(value string) bool
- func IsUrl(value string) bool
- func IsUuid(value string) bool
- func Kebab(value string) string
- func Length(value string) int
- func Limit(value string, limit int, end ...string) string
- func Lower(value string) string
- func Ltrim(value string, characters ...string) string
- func Markdown(str string) string
- func Mask(str string, character rune, index int, length ...int) string
- func Match(pattern, value string) bool
- func MatchAll(pattern, subject string) [][]string
- func PadBoth(value string, length int, pad ...string) string
- func PadLeft(value string, length int, pad ...string) string
- func PadRight(value string, length int, pad ...string) string
- func Plural(value string, count ...float64) string
- func Position(haystack, needle string) int
- func Random(length ...int) string
- func Repeat(str string, times int) string
- func Replace(search, replace, subject string) string
- func ReplaceArray(search, replace []string, subject string) string
- func ReplaceFirst(search, replace, subject string) string
- func ReplaceLast(search, replace, subject string) string
- func Reverse(value string) string
- func Rtrim(value string, characters ...string) string
- func Singular(value string) string
- func Slug(title string, separator ...string) string
- func Snake(value string) string
- func Squish(str string) string
- func SquishFast(str string) string
- func Start(value, prefix string) string
- func StartsWith(haystack string, needles ...string) bool
- func Studly(value string) string
- func Substr(str string, start int, length ...int) string
- func SubstrCount(haystack, needle string) int
- func SubstrReplace(str, replace string, offset int, length ...int) string
- func Swap(pairs map[string]string, subject string) string
- func Take(str string, limit int) string
- func Test(pattern, value string) bool
- func Title(value string) string
- func Trim(value string, characters ...string) string
- func Ucfirst(str string) string
- func Ucsplit(str string) []string
- func Upper(value string) string
- func When(condition bool, value string, callback func(string) string, ...) string
- func WhenContains(haystack, needle string, callback func(string) string, ...) string
- func WhenContainsAll(haystack string, needles []string, callback func(string) string, ...) string
- func WhenEmpty(value string, callback func(string) string, ...) string
- func WhenEndsWith(haystack string, needles []string, callback func(string) string, ...) string
- func WhenExactly(subject, value string, callback func(string) string, ...) string
- func WhenIs(pattern, value string, callback func(string) string, ...) string
- func WhenIsAscii(value string, callback func(string) string, ...) string
- func WhenIsUlid(value string, callback func(string) string, ...) string
- func WhenIsUuid(value string, callback func(string) string, ...) string
- func WhenNotEmpty(value string, callback func(string) string, ...) string
- func WhenNotExactly(subject, value string, callback func(string) string, ...) string
- func WhenStartsWith(haystack string, needles []string, callback func(string) string, ...) string
- func WhenTest(pattern, value string, callback func(string) string, ...) string
- func WordCount(str string) int
- func WordWrap(str string, width int, breakStr ...string) string
- func Words(value string, words int, end ...string) string
- type ExcerptOptions
- type Stringable
- func (s *Stringable) After(search string) *Stringable
- func (s *Stringable) AfterLast(search string) *Stringable
- func (s *Stringable) Append(values ...string) *Stringable
- func (s *Stringable) Ascii() *Stringable
- func (s *Stringable) Basename(suffix ...string) *Stringable
- func (s *Stringable) Before(search string) *Stringable
- func (s *Stringable) BeforeLast(search string) *Stringable
- func (s *Stringable) Between(from, to string) *Stringable
- func (s *Stringable) BetweenFirst(from, to string) *Stringable
- func (s *Stringable) Camel() *Stringable
- func (s *Stringable) CharAt(index int) string
- func (s *Stringable) ClassBasename() *Stringable
- func (s *Stringable) Contains(needles ...string) bool
- func (s *Stringable) ContainsAll(needles []string) bool
- func (s *Stringable) Dirname(levels ...int) *Stringable
- func (s *Stringable) EndsWith(needles ...string) bool
- func (s *Stringable) Exactly(value string) bool
- func (s *Stringable) Excerpt(phrase string, options ...ExcerptOptions) *Stringable
- func (s *Stringable) Explode(delimiter string, limit ...int) []string
- func (s *Stringable) Finish(cap string) *Stringable
- func (s *Stringable) Headline() *Stringable
- func (s *Stringable) InlineMarkdown() *Stringable
- func (s *Stringable) Is(pattern string) bool
- func (s *Stringable) IsAscii() bool
- func (s *Stringable) IsEmpty() bool
- func (s *Stringable) IsJson() bool
- func (s *Stringable) IsNotEmpty() bool
- func (s *Stringable) IsUlid() bool
- func (s *Stringable) IsUrl() bool
- func (s *Stringable) IsUuid() bool
- func (s *Stringable) Kebab() *Stringable
- func (s *Stringable) LcFirst() *Stringable
- func (s *Stringable) Length() int
- func (s *Stringable) Limit(limit int, end ...string) *Stringable
- func (s *Stringable) Lower() *Stringable
- func (s *Stringable) Ltrim(characters ...string) *Stringable
- func (s *Stringable) Markdown() *Stringable
- func (s *Stringable) Mask(character rune, index int, length ...int) *Stringable
- func (s *Stringable) Match(pattern string) bool
- func (s *Stringable) MatchAll(pattern string) [][]string
- func (s *Stringable) NewLine(count ...int) *Stringable
- func (s *Stringable) PadBoth(length int, pad ...string) *Stringable
- func (s *Stringable) PadLeft(length int, pad ...string) *Stringable
- func (s *Stringable) PadRight(length int, pad ...string) *Stringable
- func (s *Stringable) Pipe(callback func(string) interface{}) interface{}
- func (s *Stringable) Plural(count ...float64) *Stringable
- func (s *Stringable) Position(needle string) int
- func (s *Stringable) Prepend(values ...string) *Stringable
- func (s *Stringable) Remove(values ...string) *Stringable
- func (s *Stringable) Repeat(times int) *Stringable
- func (s *Stringable) Replace(search, replace string) *Stringable
- func (s *Stringable) ReplaceArray(search, replace []string) *Stringable
- func (s *Stringable) ReplaceFirst(search, replace string) *Stringable
- func (s *Stringable) ReplaceLast(search, replace string) *Stringable
- func (s *Stringable) ReplaceMatches(pattern, replace string) *Stringable
- func (s *Stringable) Reverse() *Stringable
- func (s *Stringable) Rtrim(characters ...string) *Stringable
- func (s *Stringable) Scan(format string, args ...interface{}) (int, error)
- func (s *Stringable) Singular() *Stringable
- func (s *Stringable) Slug(separator ...string) *Stringable
- func (s *Stringable) Snake() *Stringable
- func (s *Stringable) Split(delimiter string) []string
- func (s *Stringable) Squish() *Stringable
- func (s *Stringable) Start(prefix string) *Stringable
- func (s *Stringable) StartsWith(needles ...string) bool
- func (s *Stringable) String() string
- func (s *Stringable) Studly() *Stringable
- func (s *Stringable) Substr(start int, length ...int) *Stringable
- func (s *Stringable) SubstrCount(needle string) int
- func (s *Stringable) SubstrReplace(replace string, offset int, length ...int) *Stringable
- func (s *Stringable) Swap(pairs map[string]string) *Stringable
- func (s *Stringable) Take(limit int) *Stringable
- func (s *Stringable) Tap(callback func(*Stringable)) *Stringable
- func (s *Stringable) Test(pattern string) bool
- func (s *Stringable) Title() *Stringable
- func (s *Stringable) ToString() string
- func (s *Stringable) Trim(characters ...string) *Stringable
- func (s *Stringable) UcFirst() *Stringable
- func (s *Stringable) UcSplit() []string
- func (s *Stringable) Unless(condition bool, callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) Upper() *Stringable
- func (s *Stringable) When(condition bool, callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WhenContains(needle string, callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WhenContainsAll(needles []string, callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WhenEmpty(callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WhenEndsWith(needles []string, callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WhenExactly(value string, callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WhenIs(pattern string, callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WhenIsAscii(callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WhenIsUlid(callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WhenIsUuid(callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WhenNotEmpty(callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WhenNotExactly(value string, callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WhenStartsWith(needles []string, callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WhenTest(pattern string, callback func(*Stringable) *Stringable, ...) *Stringable
- func (s *Stringable) WordCount() int
- func (s *Stringable) WordWrap(width int, breakStr ...string) *Stringable
- func (s *Stringable) Words(words int, end ...string) *Stringable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func After ¶
After returns the substring after the first occurrence of the given value. If the value doesn't exist, returns the entire string.
func AfterLast ¶
AfterLast returns the substring after the last occurrence of the given value. If the value doesn't exist, returns the entire string.
func Before ¶
Before returns the substring before the first occurrence of the given value. If the value doesn't exist, returns the entire string.
func BeforeLast ¶
BeforeLast returns the substring before the last occurrence of the given value. If the value doesn't exist, returns the entire string.
func BetweenFirst ¶
BetweenFirst returns the smallest possible substring between two strings.
func ContainsAll ¶
ContainsAll checks if the string contains all of the given values.
func Excerpt ¶
func Excerpt(text, phrase string, options ...ExcerptOptions) string
func InlineMarkdown ¶
InlineMarkdown removes all Markdown formatting from the given string.
func ReplaceArray ¶
ReplaceArray replaces the occurrences of search array with replace array sequentially.
func ReplaceFirst ¶
ReplaceFirst replaces the first occurrence of the search string with the replacement string.
func ReplaceLast ¶
ReplaceLast replaces the last occurrence of the search string with the replacement string.
func SquishFast ¶
SquishFast removes all extraneous white space from a string quickly.
func StartsWith ¶
StartsWith checks if the string starts with any of the given values.
func SubstrCount ¶
SubstrCount counts the occurrences of a substring.
func SubstrReplace ¶
SubstrReplace replaces text within a portion of a string.
func When ¶
func When(condition bool, value string, callback func(string) string, defaultCallback ...func(string) string) string
When applies the callback if the given condition is true.
func WhenContains ¶
func WhenContains(haystack, needle string, callback func(string) string, defaultCallback ...func(string) string) string
WhenContains applies the callback if the string contains the given value.
func WhenContainsAll ¶
func WhenContainsAll(haystack string, needles []string, callback func(string) string, defaultCallback ...func(string) string) string
WhenContainsAll applies the callback if the string contains all given values.
func WhenEmpty ¶
func WhenEmpty(value string, callback func(string) string, defaultCallback ...func(string) string) string
WhenEmpty applies the callback if the string is empty.
func WhenEndsWith ¶
func WhenEndsWith(haystack string, needles []string, callback func(string) string, defaultCallback ...func(string) string) string
WhenEndsWith applies the callback if the string ends with the given value.
func WhenExactly ¶
func WhenExactly(subject, value string, callback func(string) string, defaultCallback ...func(string) string) string
WhenExactly applies the callback if the string exactly matches the given value.
func WhenIs ¶
func WhenIs(pattern, value string, callback func(string) string, defaultCallback ...func(string) string) string
WhenIs applies the callback if the string matches the given pattern.
func WhenIsAscii ¶
func WhenIsAscii(value string, callback func(string) string, defaultCallback ...func(string) string) string
WhenIsAscii applies the callback if the string is ASCII.
func WhenIsUlid ¶
func WhenIsUlid(value string, callback func(string) string, defaultCallback ...func(string) string) string
WhenIsUlid applies the callback if the string is a valid ULID.
func WhenIsUuid ¶
func WhenIsUuid(value string, callback func(string) string, defaultCallback ...func(string) string) string
WhenIsUuid applies the callback if the string is a valid UUID.
func WhenNotEmpty ¶
func WhenNotEmpty(value string, callback func(string) string, defaultCallback ...func(string) string) string
WhenNotEmpty applies the callback if the string is not empty.
func WhenNotExactly ¶
func WhenNotExactly(subject, value string, callback func(string) string, defaultCallback ...func(string) string) string
WhenNotExactly applies the callback if the string does not exactly match the given value.
func WhenStartsWith ¶
func WhenStartsWith(haystack string, needles []string, callback func(string) string, defaultCallback ...func(string) string) string
WhenStartsWith applies the callback if the string starts with the given value.
func WhenTest ¶
func WhenTest(pattern, value string, callback func(string) string, defaultCallback ...func(string) string) string
WhenTest applies the callback if the string matches the given regular expression.
Types ¶
type ExcerptOptions ¶
Excerpt extracts an excerpt from text that matches the given phrase.
type Stringable ¶
type Stringable struct {
// contains filtered or unexported fields
}
Stringable provides a fluent interface for string manipulation.
func Of ¶
func Of(value interface{}) *Stringable
Of creates a new Stringable instance with the given value.
func (*Stringable) After ¶
func (s *Stringable) After(search string) *Stringable
After returns the substring after the first occurrence of the given value.
func (*Stringable) AfterLast ¶
func (s *Stringable) AfterLast(search string) *Stringable
AfterLast returns the substring after the last occurrence of the given value.
func (*Stringable) Append ¶
func (s *Stringable) Append(values ...string) *Stringable
Append appends the given values to the string.
func (*Stringable) Ascii ¶
func (s *Stringable) Ascii() *Stringable
Ascii transliterates the string to ASCII.
func (*Stringable) Basename ¶
func (s *Stringable) Basename(suffix ...string) *Stringable
Basename returns the trailing name component of a path.
func (*Stringable) Before ¶
func (s *Stringable) Before(search string) *Stringable
Before returns the substring before the first occurrence of the given value.
func (*Stringable) BeforeLast ¶
func (s *Stringable) BeforeLast(search string) *Stringable
BeforeLast returns the substring before the last occurrence of the given value.
func (*Stringable) Between ¶
func (s *Stringable) Between(from, to string) *Stringable
Between returns the substring between two strings.
func (*Stringable) BetweenFirst ¶
func (s *Stringable) BetweenFirst(from, to string) *Stringable
BetweenFirst returns the smallest possible substring between two strings.
func (*Stringable) Camel ¶
func (s *Stringable) Camel() *Stringable
Camel converts the string to camelCase.
func (*Stringable) CharAt ¶
func (s *Stringable) CharAt(index int) string
CharAt returns the character at the given index.
func (*Stringable) ClassBasename ¶
func (s *Stringable) ClassBasename() *Stringable
ClassBasename returns the class basename of the class path.
func (*Stringable) Contains ¶
func (s *Stringable) Contains(needles ...string) bool
Contains checks if the string contains the given value(s).
func (*Stringable) ContainsAll ¶
func (s *Stringable) ContainsAll(needles []string) bool
ContainsAll checks if the string contains all of the given values.
func (*Stringable) Dirname ¶
func (s *Stringable) Dirname(levels ...int) *Stringable
Dirname returns the directory name from a path.
func (*Stringable) EndsWith ¶
func (s *Stringable) EndsWith(needles ...string) bool
EndsWith checks if the string ends with any of the given values.
func (*Stringable) Exactly ¶
func (s *Stringable) Exactly(value string) bool
Exactly checks if the string exactly matches the given value.
func (*Stringable) Excerpt ¶
func (s *Stringable) Excerpt(phrase string, options ...ExcerptOptions) *Stringable
Excerpt extracts an excerpt from text that matches the given phrase.
func (*Stringable) Explode ¶
func (s *Stringable) Explode(delimiter string, limit ...int) []string
Explode splits the string by the given delimiter.
func (*Stringable) Finish ¶
func (s *Stringable) Finish(cap string) *Stringable
Finish ensures the string ends with the given value.
func (*Stringable) Headline ¶
func (s *Stringable) Headline() *Stringable
Headline converts the string to a human-readable headline.
func (*Stringable) InlineMarkdown ¶
func (s *Stringable) InlineMarkdown() *Stringable
InlineMarkdown removes all Markdown formatting from the string.
func (*Stringable) Is ¶
func (s *Stringable) Is(pattern string) bool
Is checks if the string matches the given pattern.
func (*Stringable) IsAscii ¶
func (s *Stringable) IsAscii() bool
IsAscii checks if the string is 7-bit ASCII.
func (*Stringable) IsEmpty ¶
func (s *Stringable) IsEmpty() bool
IsEmpty checks if the string is empty.
func (*Stringable) IsJson ¶
func (s *Stringable) IsJson() bool
IsJson checks if the string is valid JSON.
func (*Stringable) IsNotEmpty ¶
func (s *Stringable) IsNotEmpty() bool
IsNotEmpty checks if the string is not empty.
func (*Stringable) IsUlid ¶
func (s *Stringable) IsUlid() bool
IsUlid checks if the string is a valid ULID.
func (*Stringable) IsUrl ¶
func (s *Stringable) IsUrl() bool
IsUrl checks if the string is a valid URL.
func (*Stringable) IsUuid ¶
func (s *Stringable) IsUuid() bool
IsUuid checks if the string is a valid UUID.
func (*Stringable) Kebab ¶
func (s *Stringable) Kebab() *Stringable
Kebab converts the string to kebab-case.
func (*Stringable) LcFirst ¶
func (s *Stringable) LcFirst() *Stringable
LcFirst makes the string's first character lowercase.
func (*Stringable) Length ¶
func (s *Stringable) Length() int
Length returns the length of the string.
func (*Stringable) Limit ¶
func (s *Stringable) Limit(limit int, end ...string) *Stringable
Limit limits the number of characters in the string.
func (*Stringable) Lower ¶
func (s *Stringable) Lower() *Stringable
Lower converts the string to lowercase.
func (*Stringable) Ltrim ¶
func (s *Stringable) Ltrim(characters ...string) *Stringable
Ltrim trims the left side of the string.
func (*Stringable) Markdown ¶
func (s *Stringable) Markdown() *Stringable
Markdown converts inline Markdown to HTML.
func (*Stringable) Mask ¶
func (s *Stringable) Mask(character rune, index int, length ...int) *Stringable
Mask masks a portion of the string with a repeated character.
func (*Stringable) Match ¶
func (s *Stringable) Match(pattern string) bool
Match performs a pattern match on the string.
func (*Stringable) MatchAll ¶
func (s *Stringable) MatchAll(pattern string) [][]string
MatchAll performs a global pattern match on the string.
func (*Stringable) NewLine ¶
func (s *Stringable) NewLine(count ...int) *Stringable
NewLine appends a newline to the string.
func (*Stringable) PadBoth ¶
func (s *Stringable) PadBoth(length int, pad ...string) *Stringable
PadBoth pads both sides of the string.
func (*Stringable) PadLeft ¶
func (s *Stringable) PadLeft(length int, pad ...string) *Stringable
PadLeft pads the left side of the string.
func (*Stringable) PadRight ¶
func (s *Stringable) PadRight(length int, pad ...string) *Stringable
PadRight pads the right side of the string.
func (*Stringable) Pipe ¶
func (s *Stringable) Pipe(callback func(string) interface{}) interface{}
Pipe passes the string to the given callback and returns the result.
func (*Stringable) Plural ¶
func (s *Stringable) Plural(count ...float64) *Stringable
Plural returns the plural form of a word.
func (*Stringable) Position ¶
func (s *Stringable) Position(needle string) int
Position finds the position of the first occurrence of a substring.
func (*Stringable) Prepend ¶
func (s *Stringable) Prepend(values ...string) *Stringable
Prepend prepends the given values to the string.
func (*Stringable) Remove ¶
func (s *Stringable) Remove(values ...string) *Stringable
Remove removes the given value(s) from the string.
func (*Stringable) Repeat ¶
func (s *Stringable) Repeat(times int) *Stringable
Repeat repeats the string.
func (*Stringable) Replace ¶
func (s *Stringable) Replace(search, replace string) *Stringable
Replace replaces all occurrences of the search string with the replacement string.
func (*Stringable) ReplaceArray ¶
func (s *Stringable) ReplaceArray(search, replace []string) *Stringable
ReplaceArray replaces the occurrences of search array with replace array.
func (*Stringable) ReplaceFirst ¶
func (s *Stringable) ReplaceFirst(search, replace string) *Stringable
ReplaceFirst replaces the first occurrence of the search string.
func (*Stringable) ReplaceLast ¶
func (s *Stringable) ReplaceLast(search, replace string) *Stringable
ReplaceLast replaces the last occurrence of the search string.
func (*Stringable) ReplaceMatches ¶
func (s *Stringable) ReplaceMatches(pattern, replace string) *Stringable
ReplaceMatches replaces matches of the pattern with the replacement.
func (*Stringable) Reverse ¶
func (s *Stringable) Reverse() *Stringable
Reverse reverses the string.
func (*Stringable) Rtrim ¶
func (s *Stringable) Rtrim(characters ...string) *Stringable
Rtrim trims the right side of the string.
func (*Stringable) Scan ¶
func (s *Stringable) Scan(format string, args ...interface{}) (int, error)
Scan parses the string according to the given format.
func (*Stringable) Singular ¶
func (s *Stringable) Singular() *Stringable
Singular returns the singular form of a word.
func (*Stringable) Slug ¶
func (s *Stringable) Slug(separator ...string) *Stringable
Slug generates a URL-friendly "slug" from the string.
func (*Stringable) Snake ¶
func (s *Stringable) Snake() *Stringable
Snake converts the string to snake_case.
func (*Stringable) Split ¶
func (s *Stringable) Split(delimiter string) []string
Split splits the string by the given delimiter.
func (*Stringable) Squish ¶
func (s *Stringable) Squish() *Stringable
Squish removes all extraneous white space from the string.
func (*Stringable) Start ¶
func (s *Stringable) Start(prefix string) *Stringable
Start ensures the string starts with the given value.
func (*Stringable) StartsWith ¶
func (s *Stringable) StartsWith(needles ...string) bool
StartsWith checks if the string starts with any of the given values.
func (*Stringable) String ¶
func (s *Stringable) String() string
String returns the underlying string value.
func (*Stringable) Studly ¶
func (s *Stringable) Studly() *Stringable
Studly converts the string to StudlyCase.
func (*Stringable) Substr ¶
func (s *Stringable) Substr(start int, length ...int) *Stringable
Substr returns a substring starting at the given position.
func (*Stringable) SubstrCount ¶
func (s *Stringable) SubstrCount(needle string) int
SubstrCount counts the occurrences of a substring.
func (*Stringable) SubstrReplace ¶
func (s *Stringable) SubstrReplace(replace string, offset int, length ...int) *Stringable
SubstrReplace replaces text within a portion of the string.
func (*Stringable) Swap ¶
func (s *Stringable) Swap(pairs map[string]string) *Stringable
Swap replaces multiple values in the string using a map.
func (*Stringable) Take ¶
func (s *Stringable) Take(limit int) *Stringable
Take returns the first or last n characters of the string.
func (*Stringable) Tap ¶
func (s *Stringable) Tap(callback func(*Stringable)) *Stringable
Tap passes the string to the given callback and returns the Stringable.
func (*Stringable) Test ¶
func (s *Stringable) Test(pattern string) bool
Test checks if the string matches the given regular expression.
func (*Stringable) Title ¶
func (s *Stringable) Title() *Stringable
Title converts the string to title case.
func (*Stringable) ToString ¶
func (s *Stringable) ToString() string
ToString is an alias for String.
func (*Stringable) Trim ¶
func (s *Stringable) Trim(characters ...string) *Stringable
Trim trims the string of the given characters.
func (*Stringable) UcFirst ¶
func (s *Stringable) UcFirst() *Stringable
UcFirst makes the string's first character uppercase.
func (*Stringable) UcSplit ¶
func (s *Stringable) UcSplit() []string
UcSplit splits the string by uppercase characters.
func (*Stringable) Unless ¶
func (s *Stringable) Unless(condition bool, callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
Unless applies the callback if the given condition is false.
func (*Stringable) Upper ¶
func (s *Stringable) Upper() *Stringable
Upper converts the string to uppercase.
func (*Stringable) When ¶
func (s *Stringable) When(condition bool, callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
When applies the callback if the given condition is true.
func (*Stringable) WhenContains ¶
func (s *Stringable) WhenContains(needle string, callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
WhenContains applies the callback if the string contains the given value.
func (*Stringable) WhenContainsAll ¶
func (s *Stringable) WhenContainsAll(needles []string, callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
WhenContainsAll applies the callback if the string contains all given values.
func (*Stringable) WhenEmpty ¶
func (s *Stringable) WhenEmpty(callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
WhenEmpty applies the callback if the string is empty.
func (*Stringable) WhenEndsWith ¶
func (s *Stringable) WhenEndsWith(needles []string, callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
WhenEndsWith applies the callback if the string ends with the given value.
func (*Stringable) WhenExactly ¶
func (s *Stringable) WhenExactly(value string, callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
WhenExactly applies the callback if the string exactly matches the given value.
func (*Stringable) WhenIs ¶
func (s *Stringable) WhenIs(pattern string, callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
WhenIs applies the callback if the string matches the given pattern.
func (*Stringable) WhenIsAscii ¶
func (s *Stringable) WhenIsAscii(callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
WhenIsAscii applies the callback if the string is ASCII.
func (*Stringable) WhenIsUlid ¶
func (s *Stringable) WhenIsUlid(callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
WhenIsUlid applies the callback if the string is a valid ULID.
func (*Stringable) WhenIsUuid ¶
func (s *Stringable) WhenIsUuid(callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
WhenIsUuid applies the callback if the string is a valid UUID.
func (*Stringable) WhenNotEmpty ¶
func (s *Stringable) WhenNotEmpty(callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
WhenNotEmpty applies the callback if the string is not empty.
func (*Stringable) WhenNotExactly ¶
func (s *Stringable) WhenNotExactly(value string, callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
WhenNotExactly applies the callback if the string does not exactly match the given value.
func (*Stringable) WhenStartsWith ¶
func (s *Stringable) WhenStartsWith(needles []string, callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
WhenStartsWith applies the callback if the string starts with the given value.
func (*Stringable) WhenTest ¶
func (s *Stringable) WhenTest(pattern string, callback func(*Stringable) *Stringable, defaultCallback ...func(*Stringable) *Stringable) *Stringable
WhenTest applies the callback if the string matches the given regular expression.
func (*Stringable) WordCount ¶
func (s *Stringable) WordCount() int
WordCount counts the words in the string.
func (*Stringable) WordWrap ¶
func (s *Stringable) WordWrap(width int, breakStr ...string) *Stringable
WordWrap wraps the string at the given length.
func (*Stringable) Words ¶
func (s *Stringable) Words(words int, end ...string) *Stringable
Words limits the number of words in the string.