Documentation ¶
Index ¶
- func Camel2Case(name string) string
- func Case2Camel(name string) string
- func Random(length int) string
- func Substr(str string, start int, length ...int) string
- type Buffer
- type ExcerptOption
- type String
- func (s *String) After(search string) *String
- func (s *String) AfterLast(search string) *String
- func (s *String) Append(values ...string) *String
- func (s *String) Basename(suffix ...string) *String
- func (s *String) Before(search string) *String
- func (s *String) BeforeLast(search string) *String
- func (s *String) Between(start, end string) *String
- func (s *String) BetweenFirst(start, end string) *String
- func (s *String) Camel() *String
- func (s *String) CharAt(index int) string
- func (s *String) ChopEnd(needle string, more ...string) *String
- func (s *String) ChopStart(needle string, more ...string) *String
- func (s *String) Contains(values ...string) bool
- func (s *String) ContainsAll(values ...string) bool
- func (s *String) Dirname(levels ...int) *String
- func (s *String) EndsWith(values ...string) bool
- func (s *String) Exactly(value string) bool
- func (s *String) Excerpt(phrase string, options ...ExcerptOption) *String
- func (s *String) Explode(delimiter string, limit ...int) []string
- func (s *String) Finish(value string) *String
- func (s *String) Headline() *String
- func (s *String) Is(patterns ...string) bool
- func (s *String) IsAscii() bool
- func (s *String) IsEmpty() bool
- func (s *String) IsMap() bool
- func (s *String) IsMatch(patterns ...string) bool
- func (s *String) IsNotEmpty() bool
- func (s *String) IsSlice() bool
- func (s *String) IsUlid() bool
- func (s *String) IsUuid() bool
- func (s *String) Kebab() *String
- func (s *String) LTrim(characters ...string) *String
- func (s *String) LcFirst() *String
- func (s *String) Length() int
- func (s *String) Limit(limit int, end ...string) *String
- func (s *String) Lower() *String
- func (s *String) Mask(character string, index int, length ...int) *String
- func (s *String) Match(pattern string) *String
- func (s *String) MatchAll(pattern string) []string
- func (s *String) NewLine(count ...int) *String
- func (s *String) PadBoth(length int, pad ...string) *String
- func (s *String) PadLeft(length int, pad ...string) *String
- func (s *String) PadRight(length int, pad ...string) *String
- func (s *String) Pipe(callback func(s string) string) *String
- func (s *String) Prepend(values ...string) *String
- func (s *String) RTrim(characters ...string) *String
- func (s *String) Remove(values ...string) *String
- func (s *String) Repeat(times int) *String
- func (s *String) Replace(search string, replace string, caseSensitive ...bool) *String
- func (s *String) ReplaceEnd(search string, replace string) *String
- func (s *String) ReplaceFirst(search string, replace string) *String
- func (s *String) ReplaceLast(search string, replace string) *String
- func (s *String) ReplaceMatches(pattern string, replace string) *String
- func (s *String) ReplaceStart(search string, replace string) *String
- func (s *String) Snake(delimiter ...string) *String
- func (s *String) Split(pattern string, limit ...int) []string
- func (s *String) Squish() *String
- func (s *String) Start(prefix string) *String
- func (s *String) StartsWith(values ...string) bool
- func (s *String) String() string
- func (s *String) Studly() *String
- func (s *String) Substr(start int, length ...int) *String
- func (s *String) Swap(replacements map[string]string) *String
- func (s *String) Tap(callback func(String)) *String
- func (s *String) Test(pattern string) bool
- func (s *String) Title() *String
- func (s *String) Trim(characters ...string) *String
- func (s *String) UcFirst() *String
- func (s *String) UcSplit() []string
- func (s *String) Unless(callback func(*String) bool, fallback func(*String) *String) *String
- func (s *String) Upper() *String
- func (s *String) When(condition bool, callback ...func(*String) *String) *String
- func (s *String) WhenContains(value string, callback ...func(*String) *String) *String
- func (s *String) WhenContainsAll(values []string, callback ...func(*String) *String) *String
- func (s *String) WhenEmpty(callback ...func(*String) *String) *String
- func (s *String) WhenEndsWith(value []string, callback ...func(*String) *String) *String
- func (s *String) WhenExactly(value string, callback ...func(*String) *String) *String
- func (s *String) WhenIs(value string, callback ...func(*String) *String) *String
- func (s *String) WhenIsAscii(callback ...func(*String) *String) *String
- func (s *String) WhenIsUlid(callback ...func(*String) *String) *String
- func (s *String) WhenIsUuid(callback ...func(*String) *String) *String
- func (s *String) WhenNotEmpty(callback ...func(*String) *String) *String
- func (s *String) WhenNotExactly(value string, callback ...func(*String) *String) *String
- func (s *String) WhenStartsWith(value []string, callback ...func(*String) *String) *String
- func (s *String) WhenTest(pattern string, callback ...func(*String) *String) *String
- func (s *String) WordCount() int
- func (s *String) Words(limit int, end ...string) *String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Camel2Case ¶
Camel2Case DEPRECATED: Use str.Of(name).Snake().String() instead
func Case2Camel ¶
Case2Camel DEPRECATED: Use str.Of(name).Studly().String() instead
Types ¶
type ExcerptOption ¶
ExcerptOption is the option for Excerpt method
type String ¶
type String struct {
// contains filtered or unexported fields
}
func (*String) After ¶
After returns a new String instance with the substring after the first occurrence of the specified search string.
func (*String) AfterLast ¶
AfterLast returns the String instance with the substring after the last occurrence of the specified search string.
func (*String) Basename ¶
Basename returns the String instance with the basename of the current file path string, and trims the suffix based on the parameter(optional).
func (*String) Before ¶
Before returns the String instance with the substring before the first occurrence of the specified search string.
func (*String) BeforeLast ¶
BeforeLast returns the String instance with the substring before the last occurrence of the specified search string.
func (*String) Between ¶
Between returns the String instance with the substring between the given start and end strings.
func (*String) BetweenFirst ¶
BetweenFirst returns the String instance with the substring between the first occurrence of the given start string and the given end string.
func (*String) ChopEnd ¶
ChopEnd remove the given string(s) if it exists at the end of the haystack.
func (*String) ChopStart ¶
ChopStart remove the given string(s) if it exists at the start of the haystack.
func (*String) Contains ¶
Contains returns true if the string contains the given value or any of the values.
func (*String) ContainsAll ¶
ContainsAll returns true if the string contains all of the given values.
func (*String) Dirname ¶
Dirname returns the String instance with the directory name of the current file path string.
func (*String) EndsWith ¶
EndsWith returns true if the string ends with the given value or any of the values.
func (*String) Excerpt ¶
func (s *String) Excerpt(phrase string, options ...ExcerptOption) *String
Excerpt returns the String instance truncated to the given length.
func (*String) Finish ¶
Finish returns the String instance with the given value appended. If the given value already ends with the suffix, it will not be added twice.
func (*String) IsNotEmpty ¶
IsNotEmpty returns true if the string is not empty.
func (*String) LTrim ¶
Ltrim returns the String instance with the leftmost occurrence of the given value removed.
func (*String) Mask ¶
Mask returns the String instance with the given character masking the specified number of characters.
func (*String) Match ¶
Match returns the String instance with the first occurrence of the given pattern.
func (*String) PadBoth ¶
PadBoth returns the String instance padded to the left and right sides of the given length.
func (*String) PadLeft ¶
PadLeft returns the String instance padded to the left side of the given length.
func (*String) PadRight ¶
PadRight returns the String instance padded to the right side of the given length.
func (*String) RTrim ¶
RTrim returns the String instance with the right occurrences of the given value removed.
func (*String) Remove ¶
Remove returns the String instance with the first occurrence of the given value removed.
func (*String) Replace ¶
Replace returns the String instance with all occurrences of the search string replaced by the given replacement string.
func (*String) ReplaceEnd ¶
ReplaceEnd returns the String instance with the last occurrence of the given value replaced.
func (*String) ReplaceFirst ¶
ReplaceFirst returns the String instance with the first occurrence of the given value replaced.
func (*String) ReplaceLast ¶
ReplaceLast returns the String instance with the last occurrence of the given value replaced.
func (*String) ReplaceMatches ¶
ReplaceMatches returns the String instance with all occurrences of the given pattern replaced by the given replacement string.
func (*String) ReplaceStart ¶
ReplaceStart returns the String instance with the first occurrence of the given value replaced.
func (*String) Squish ¶
Squish returns the String instance with consecutive whitespace characters collapsed into a single space.
func (*String) StartsWith ¶
StartsWith returns true if the string starts with the given value or any of the values.
func (*String) Substr ¶
Substr returns the String instance starting at the given index with the specified length.
func (*String) Swap ¶
Swap replaces all occurrences of the search string with the given replacement string.
func (*String) Trim ¶
Trim returns the String instance with trimmed characters from the left and right sides.
func (*String) UcSplit ¶
UcSplit splits the string into words using uppercase characters as the delimiter.
func (*String) Unless ¶
Unless returns the String instance with the given fallback applied if the given condition is false.
func (*String) When ¶
When returns the String instance with the given callback applied if the given condition is true. If the condition is false, the fallback callback is applied.(if provided)
func (*String) WhenContains ¶
WhenContains returns the String instance with the given callback applied if the string contains the given value.
func (*String) WhenContainsAll ¶
WhenContainsAll returns the String instance with the given callback applied if the string contains all the given values.
func (*String) WhenEmpty ¶
WhenEmpty returns the String instance with the given callback applied if the string is empty.
func (*String) WhenEndsWith ¶
WhenEndsWith returns the String instance with the given callback applied if the string ends with the given value.
func (*String) WhenExactly ¶
WhenExactly returns the String instance with the given callback applied if the string is exactly the given value.
func (*String) WhenIs ¶
WhenIs returns the String instance with the given callback applied if the string matches any of the given patterns.
func (*String) WhenIsAscii ¶
WhenIsAscii returns the String instance with the given callback applied if the string contains only ASCII characters.
func (*String) WhenIsUlid ¶
WhenIsUlid returns the String instance with the given callback applied if the string is a valid ULID.
func (*String) WhenIsUuid ¶
WhenIsUuid returns the String instance with the given callback applied if the string is a valid UUID.
func (*String) WhenNotEmpty ¶
WhenNotEmpty returns the String instance with the given callback applied if the string is not empty.
func (*String) WhenNotExactly ¶
WhenNotExactly returns the String instance with the given callback applied if the string is not exactly the given value.
func (*String) WhenStartsWith ¶
WhenStartsWith returns the String instance with the given callback applied if the string starts with the given value.
func (*String) WhenTest ¶
WhenTest returns the String instance with the given callback applied if the string matches the given pattern.