Documentation
¶
Index ¶
- func CollapseSpaces(s string) string
- func ConstantTimeEqual(a, b string) bool
- func ContainsFold(s, substr string) bool
- func HasPrefixFold(s, prefix string) bool
- func HasSuffixFold(s, suffix string) bool
- func IndexFold(s, substr string) int
- func LongestCommonPrefix(in []string) string
- func LongestSequenceOf(a string, b rune) int
- func LongestSequenceOfFunc(a string, fn func(b rune) int) int
- func PrefixByteRunLength(s string, b byte) int
- func SHA256(str string) [32]byte
- func UnsafeBytes(str string) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollapseSpaces ¶ added in v0.9.0
CollapseSpaces replaces all runs of multiple spaces (\x20) in a string with a single space.
func ConstantTimeEqual ¶
ConstantTimeEqual compares two strings using subtle.ConstantTimeCompare without copying the strings.
Note that ConstantTimeCompare is not constant time if the strings are of different length.
func ContainsFold ¶ added in v0.9.9
func HasPrefixFold ¶ added in v0.9.9
func HasSuffixFold ¶ added in v0.9.9
func LongestCommonPrefix ¶ added in v0.9.3
func LongestSequenceOf ¶ added in v0.8.7
LongestSequenceOf returns the length of the longest contiguous sequence of a single rune in a string.
func LongestSequenceOfFunc ¶ added in v0.8.8
LongestSequenceOfFunc returns the length of the longest contiguous sequence of runes in a string.
If the provided function returns zero or higher, the return value is added to the current count. If the return value is negative, the count is reset to zero.
func PrefixByteRunLength ¶ added in v0.9.0
PrefixByteRunLength returns the number of the given byte at the start of a string.
func UnsafeBytes ¶
UnsafeBytes returns a byte slice that points to the same memory as the input string.
The returned byte slice must not be modified.
See go.mau.fi/util/exbytes.UnsafeString for the reverse operation.
Types ¶
This section is empty.