Documentation
¶
Overview ¶
Package xtype provides extended type definitions with additional utility methods.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bytes ¶
type Bytes []byte
Bytes is a byte slice type with additional utility methods. It provides convenient methods for common byte slice operations.
func (Bytes) Bytes ¶
Bytes returns the underlying byte slice. This method provides a consistent interface for accessing the raw bytes.
type String ¶
type String string
String is an extended string type with additional utility methods. It provides convenient methods for common string operations.
func (String) Bytes ¶
Bytes converts the string to a byte slice using unsafe pointer casting. This is more efficient than []byte() conversion as it avoids copying. Warning: The returned byte slice shares memory with the original string.
func (String) Lower ¶
Lower converts the string to lowercase. This is a convenience method that wraps strings.ToLower.
func (String) Short ¶
Short creates an abbreviated version of the string using the default separator "-". It takes the first character of each segment split by hyphens. For example, "hello-world-test" becomes "HWT".
func (String) ShortBySign ¶
ShortBySign creates an abbreviated version of the string using a custom separator. It splits the string by the provided sign, converts to uppercase, and takes the first character of each non-empty segment to form an abbreviation. For example, with sign=".", "hello.world.test" becomes "HWT". Optimized version using strings.Builder to reduce memory allocations.