Documentation ¶
Overview ¶
Package text wraps the default string type and adds useful methods, OOP style
Index ¶
- type Text
- func (t Text) ByteSize() int
- func (t Text) Capitalize() Text
- func (t Text) Count(phrase string) int
- func (t Text) DeletePattern(s string) Text
- func (t Text) DeleteString(s string) Text
- func (t Text) DoesContainString(s string) bool
- func (t Text) DoesMatchPattern(s string) bool
- func (t Text) Downcase() Text
- func (t Text) EachByte(f func(byte))
- func (t Text) EachChar(f func(string))
- func (t Text) EachLine(f func(string))
- func (t Text) EndsWith(pattern string) bool
- func (t Text) EscapeHTML() Text
- func (t Text) First(i int) Text
- func (t Text) Index(seq string) int
- func (t Text) IsASCIIOnly() bool
- func (t Text) IsEmpty() bool
- func (t Text) IsEqual(s string) bool
- func (t Text) Last(i int) Text
- func (t Text) LeftJust(length int) Text
- func (t Text) LeftJustString(length int, seq string) Text
- func (t Text) LeftPad(i int) Text
- func (t Text) LeftPadString(i int, seq string) Text
- func (t Text) Length() int
- func (t Text) MapBytes(f func(byte) byte) Text
- func (t Text) MapChars(f func(string) string) Text
- func (t Text) MapLines(f func(string) string) Text
- func (t Text) ReplacePattern(pattern string, new string) Text
- func (t Text) ReplaceString(old string, new string) Text
- func (t Text) Reverse() Text
- func (t Text) RightJust(length int) Text
- func (t Text) RightJustString(length int, seq string) Text
- func (t Text) RightPad(i int) Text
- func (t Text) RightPadString(i int, seq string) Text
- func (t Text) Slice(from int, to int) Text
- func (t Text) SplitPattern(pattern string) []string
- func (t Text) SplitString(pattern string) []string
- func (t Text) StartsWith(pattern string) bool
- func (t Text) Strip() Text
- func (t Text) StripLeft() Text
- func (t Text) StripRight() Text
- func (t Text) ToBytes() []byte
- func (t Text) ToChars() []string
- func (t Text) ToFloat() float64
- func (t Text) ToInt() int
- func (t Text) ToLines() []string
- func (t Text) ToString() string
- func (t Text) UnescapeHTML() Text
- func (t Text) Upcase() Text
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Text ¶
type Text string
Text is the same as a string, comparison operators etc apply as usual
func (Text) Capitalize ¶
Capitalize uppercases the first letter of every word
func (Text) DeletePattern ¶
DeletePattern Removes every occurence of the given regex pattern from the text
func (Text) DeleteString ¶
DeleteString Removes every occurence of the given string from the text
func (Text) DoesContainString ¶
DoesContainString checks whether a given string is contained in the text.
func (Text) DoesMatchPattern ¶
DoesMatchPattern tests a gioven regex string against the text
func (Text) EscapeHTML ¶
EscapeHTML translates `<` to `<`, and so on
func (Text) IsASCIIOnly ¶
IsASCIIOnly checks if the string contain unicode characters
func (Text) LeftJust ¶
LeftJust increases the length of the string to `i` characters, preps whitespace to left
func (Text) LeftJustString ¶
LeftJustString increases the length of the string to `i` characters, preps `seq` to left
func (Text) LeftPadString ¶
LeftPadString prepends `i` times the given sequence to a string
func (Text) ReplacePattern ¶
ReplacePattern accepts a regex pattern as a string, same as ReplaceString()
func (Text) ReplaceString ¶
ReplaceString replaces all occurences of `old` with `new`
func (Text) RightJust ¶
RightJust increases the length of the string to `i` characters, appends whitespace to left
func (Text) RightJustString ¶
RightJustString increases the length of the string to `i` characters, app `seq` to left
func (Text) RightPadString ¶
RightPadString appends `i` times the given sequence to a string
func (Text) SplitPattern ¶
SplitPattern is the same as SplitString, but uses regex pattern as a string
func (Text) SplitString ¶
SplitString splits the string on every occurence of a given pattern
func (Text) StartsWith ¶
StartsWith checks whether the strings first characters match the given pattern
func (Text) StripRight ¶
StripRight removes all whitespace at the end of the string
func (Text) UnescapeHTML ¶
UnescapeHTML translates `<` to `<`, and so on