gxstrings

package
v1.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 4 Imported by: 8 modules, 10 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMatchPattern added in v1.8.0

func IsMatchPattern(pattern string, value string) bool

IsMatchPattern is used to determine whether pattern and value match with wildcards currently supported *

func IsNil

func IsNil(i interface{}) bool

IsNil checks whether the given interface value is nil. It performs a deep nil check by examining both the interface itself and the underlying value using reflection. Returns true if the value is nil or if the underlying value is nil. For non-nilable types (e.g., int, string, struct), it returns false.

func RegSplit added in v1.3.0

func RegSplit(text string, regexSplit string) []string

RegSplit splits a string by a regular expression pattern. It uses the provided regex pattern to find all split positions in the text and returns a slice of substrings between those positions.

Parameters:

  • text: The string to be split
  • regexSplit: The regular expression pattern used as delimiter

Returns a slice of strings containing the split results.

Example:

RegSplit("a;b;c", "\\s*[;]+\\s*") returns ["a", "b", "c"]

func Slice added in v1.11.25

func Slice(s string) []byte

Slice converts a string to a byte slice without memory allocation. It uses unsafe operations to directly reference the underlying string data, avoiding the overhead of copying bytes.

WARNING: This function uses unsafe operations. The returned byte slice shares the same underlying memory as the string. Modifying the returned slice will cause undefined behavior since strings are immutable in Go.

Parameters:

  • s: The string to convert

Returns a byte slice that references the string's underlying data.

Use this function only when you need read-only access to string bytes with zero allocation, and you understand the safety implications.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL