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) 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 ¶ added in v1.0.0
func Case2Camel ¶ added in v1.0.0
Types ¶
type ExcerptOption ¶ added in v1.13.2
ExcerptOption is the option for Excerpt method
type String ¶ added in v1.13.2
type String struct {
// contains filtered or unexported fields
}
func (*String) After ¶ added in v1.13.2
After returns a new String instance with the substring after the first occurrence of the specified search string.
func (*String) AfterLast ¶ added in v1.13.2
AfterLast returns the String instance with the substring after the last occurrence of the specified search string.
func (*String) Basename ¶ added in v1.13.2
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 ¶ added in v1.13.2
Before returns the String instance with the substring before the first occurrence of the specified search string.
func (*String) BeforeLast ¶ added in v1.13.2
BeforeLast returns the String instance with the substring before the last occurrence of the specified search string.
func (*String) Between ¶ added in v1.13.2
Between returns the String instance with the substring between the given start and end strings.
func (*String) BetweenFirst ¶ added in v1.13.2
BetweenFirst returns the String instance with the substring between the first occurrence of the given start string and the given end string.
func (*String) Contains ¶ added in v1.13.2
Contains returns true if the string contains the given value or any of the values.
func (*String) ContainsAll ¶ added in v1.13.2
ContainsAll returns true if the string contains all of the given values.
func (*String) Dirname ¶ added in v1.13.2
Dirname returns the String instance with the directory name of the current file path string.
func (*String) EndsWith ¶ added in v1.13.2
EndsWith returns true if the string ends with the given value or any of the values.
func (*String) Exactly ¶ added in v1.13.2
Exactly returns true if the string is exactly the given value.
func (*String) Excerpt ¶ added in v1.13.2
func (s *String) Excerpt(phrase string, options ...ExcerptOption) *String
Excerpt returns the String instance truncated to the given length.
func (*String) Finish ¶ added in v1.13.2
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) Is ¶ added in v1.13.2
Is returns true if the string matches any of the given patterns.
func (*String) IsAscii ¶ added in v1.13.2
IsAscii returns true if the string contains only ASCII characters.
func (*String) IsMatch ¶ added in v1.13.2
IsMatch returns true if the string matches any of the given patterns.
func (*String) IsNotEmpty ¶ added in v1.13.2
IsNotEmpty returns true if the string is not empty.
func (*String) LTrim ¶ added in v1.13.2
Ltrim returns the String instance with the leftmost occurrence of the given value removed.
func (*String) LcFirst ¶ added in v1.13.2
LcFirst returns the String instance with the first character lowercased.
func (*String) Limit ¶ added in v1.13.2
Limit returns the String instance truncated to the given length.
func (*String) Mask ¶ added in v1.13.2
Mask returns the String instance with the given character masking the specified number of characters.
func (*String) Match ¶ added in v1.13.2
Match returns the String instance with the first occurrence of the given pattern.
func (*String) MatchAll ¶ added in v1.13.2
MatchAll returns all matches for the given regular expression.
func (*String) NewLine ¶ added in v1.13.2
NewLine appends one or more new lines to the current string.
func (*String) PadBoth ¶ added in v1.13.2
PadBoth returns the String instance padded to the left and right sides of the given length.
func (*String) PadLeft ¶ added in v1.13.2
PadLeft returns the String instance padded to the left side of the given length.
func (*String) PadRight ¶ added in v1.13.2
PadRight returns the String instance padded to the right side of the given length.
func (*String) Pipe ¶ added in v1.13.2
Pipe passes the string to the given callback and returns the result.
func (*String) RTrim ¶ added in v1.13.2
RTrim returns the String instance with the right occurrences of the given value removed.
func (*String) Remove ¶ added in v1.13.2
Remove returns the String instance with the first occurrence of the given value removed.
func (*String) Repeat ¶ added in v1.13.2
Repeat returns the String instance repeated the given number of times.
func (*String) Replace ¶ added in v1.13.2
Replace returns the String instance with all occurrences of the search string replaced by the given replacement string.
func (*String) ReplaceEnd ¶ added in v1.13.2
ReplaceEnd returns the String instance with the last occurrence of the given value replaced.
func (*String) ReplaceFirst ¶ added in v1.13.2
ReplaceFirst returns the String instance with the first occurrence of the given value replaced.
func (*String) ReplaceLast ¶ added in v1.13.2
ReplaceLast returns the String instance with the last occurrence of the given value replaced.
func (*String) ReplaceMatches ¶ added in v1.13.2
ReplaceMatches returns the String instance with all occurrences of the given pattern replaced by the given replacement string.
func (*String) ReplaceStart ¶ added in v1.13.2
ReplaceStart returns the String instance with the first occurrence of the given value replaced.
func (*String) Squish ¶ added in v1.13.2
Squish returns the String instance with consecutive whitespace characters collapsed into a single space.
func (*String) Start ¶ added in v1.13.2
Start returns the String instance with the given value prepended.
func (*String) StartsWith ¶ added in v1.13.2
StartsWith returns true if the string starts with the given value or any of the values.
func (*String) Substr ¶ added in v1.13.2
Substr returns the String instance starting at the given index with the specified length.
func (*String) Swap ¶ added in v1.13.2
Swap replaces all occurrences of the search string with the given replacement string.
func (*String) Tap ¶ added in v1.13.2
Tap passes the string to the given callback and returns the string.
func (*String) Trim ¶ added in v1.13.2
Trim returns the String instance with trimmed characters from the left and right sides.
func (*String) UcFirst ¶ added in v1.13.2
UcFirst returns the String instance with the first character uppercased.
func (*String) UcSplit ¶ added in v1.13.2
UcSplit splits the string into words using uppercase characters as the delimiter.
func (*String) Unless ¶ added in v1.13.2
Unless returns the String instance with the given fallback applied if the given condition is false.
func (*String) When ¶ added in v1.13.2
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 ¶ added in v1.13.2
WhenContains returns the String instance with the given callback applied if the string contains the given value.
func (*String) WhenContainsAll ¶ added in v1.13.2
WhenContainsAll returns the String instance with the given callback applied if the string contains all the given values.
func (*String) WhenEmpty ¶ added in v1.13.2
WhenEmpty returns the String instance with the given callback applied if the string is empty.
func (*String) WhenEndsWith ¶ added in v1.13.2
WhenEndsWith returns the String instance with the given callback applied if the string ends with the given value.
func (*String) WhenExactly ¶ added in v1.13.2
WhenExactly returns the String instance with the given callback applied if the string is exactly the given value.
func (*String) WhenIs ¶ added in v1.13.2
WhenIs returns the String instance with the given callback applied if the string matches any of the given patterns.
func (*String) WhenIsAscii ¶ added in v1.13.2
WhenIsAscii returns the String instance with the given callback applied if the string contains only ASCII characters.
func (*String) WhenIsUlid ¶ added in v1.13.2
WhenIsUlid returns the String instance with the given callback applied if the string is a valid ULID.
func (*String) WhenIsUuid ¶ added in v1.13.2
WhenIsUuid returns the String instance with the given callback applied if the string is a valid UUID.
func (*String) WhenNotEmpty ¶ added in v1.13.2
WhenNotEmpty returns the String instance with the given callback applied if the string is not empty.
func (*String) WhenNotExactly ¶ added in v1.13.2
WhenNotExactly returns the String instance with the given callback applied if the string is not exactly the given value.
func (*String) WhenStartsWith ¶ added in v1.13.2
WhenStartsWith returns the String instance with the given callback applied if the string starts with the given value.
func (*String) WhenTest ¶ added in v1.13.2
WhenTest returns the String instance with the given callback applied if the string matches the given pattern.