Documentation ¶
Overview ¶
Package strutil provides various utilities for manipulating strings
Index ¶
- func InterpolateString(val string, env map[string]interface{}) (string, error)
- func JoinURL(elem ...string) string
- func NewUUIDV4() string
- func PadLeft(str string, length int, pad byte) string
- func PadRight(str string, length int, pad byte) string
- func Pointer(v interface{}) *string
- func PrettyTime(t time.Duration) string
- func Resize(s string, length uint) string
- func SortCopy(arr []string) []string
- func Value(v interface{}) string
- type CloseableStringReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InterpolateString ¶
InterpolateString will replace { } in string
func PadLeft ¶
PadLeft returns a new string of a specified length in which the beginning of the current string is padded with spaces or with a specified Unicode character.
func PadRight ¶
PadRight returns a new string of a specified length in which the end of the current string is padded with spaces or with a specified Unicode character.
func Pointer ¶
func Pointer(v interface{}) *string
Pointer will return a pointer to a string handling empty string as nil
func PrettyTime ¶
PrettyTime returns the string representation of the duration. It rounds the time duration to a second and returns a "---" when duration is 0
func Resize ¶
Resize resizes the string with the given length. It ellipses with '...' when the string's length exceeds the desired length or pads spaces to the right of the string when length is smaller than desired
Types ¶
type CloseableStringReader ¶
type CloseableStringReader struct {
// contains filtered or unexported fields
}
CloseableStringReader is a string reader which implements the io.ReadCloser interface
func NewCloseableStringReader ¶
func NewCloseableStringReader(input string) *CloseableStringReader
NewCloseableStringReader will return a closeable reader
func (*CloseableStringReader) Close ¶
func (r *CloseableStringReader) Close() error
Close will do nothing