Documentation
¶
Index ¶
- Variables
- func Atoi(s string) int
- func ConvertSummarizedString2Int(s string) int
- func IsLetter[T rune | byte](r T) bool
- func Partition(s string, sep rune) (string, string)
- func RandomString(n int) string
- func Reverse(input string) string
- func S2b(s string) []byte
- func String2Int(s string) int
- func String2Int64(s string) int64
- func String2IntWithChecking(s string) (int, error)
- func ToLower(o string) string
- func ToTitleCase(s string) string
- func ToUpper(o string) string
- func TrimLeft(s, cutset string) string
- func UnsafeToLower(o byte) byte
- func UnsafeToUpper(o byte) byte
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidInt = errors.New("invalid integer syntax")
Functions ¶
func Atoi ¶
Atoi is an alias for String2Int, mimicking standard library naming. Optimization: Same as String2Int.
func ConvertSummarizedString2Int ¶
ConvertSummarizedString2Int converts a summarized string (e.g., "1k") to an integer. Optimization: Manual parsing with minimal allocations.
func IsLetter ¶
IsLetter checks if a rune or byte is a letter. Optimization: Simple range check with no allocations.
func Partition ¶
Partition splits a string around the first occurrence of a separator rune. Optimization: Uses strings.IndexRune for efficient search.
func RandomString ¶
RandomString generates a random string of length n. Optimization: Efficient bit manipulation for random generation.
func Reverse ¶
Reverse reverses a string in-place using unsafe operations. Optimization: Zero-copy reversal with unsafe pointer manipulation.
func S2b ¶
S2b converts a string to a byte slice without copying. Optimization: Zero-copy using unsafe operations.
func String2Int ¶
String2Int converts a string to an integer without error checking. Optimization: Manual conversion for speed over strconv.
func String2Int64 ¶
String2Int64 converts a string to an int64 using String2Int. Optimization: Leverages optimized String2Int.
func String2IntWithChecking ¶
String2IntWithChecking converts a string to an integer with error checking. Optimization: Adds validation with minimal overhead.
func ToLower ¶
ToLower converts a string to lowercase. Optimization: Uses UnsafeToLower with single allocation.
func ToTitleCase ¶
ToTitleCase converts a string to title case. Optimization: Single pass with minimal allocations.
func ToUpper ¶
ToUpper converts a string to uppercase. Optimization: Uses UnsafeToUpper with single allocation.
func TrimLeft ¶
TrimLeft trims the left side of a string by removing repeated cutset. Optimization: Single pass with minimal slicing.
func UnsafeToLower ¶
UnsafeToLower converts a byte to lowercase if it’s an uppercase letter. Optimization: Inline operation with minimal branching.
func UnsafeToUpper ¶
UnsafeToUpper converts a byte to uppercase if it’s a lowercase letter. Optimization: Inline operation with minimal branching.
Types ¶
This section is empty.