zstring

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 License: MIT Imports: 10 Imported by: 35

Documentation

Overview

Package zstring provides String related operations

Index

Constants

View Source
const (
	// PadRight Right padding character
	PadRight int = iota
	// PadLeft Left padding character
	PadLeft
	// PadSides Two-sided padding characters,If the two sides are not equal, the right side takes precedence.
	PadSides
)

Variables

This section is empty.

Functions

func Buffer

func Buffer() (b strings.Builder)

Buffer Buffer

func Bytes2String

func Bytes2String(b []byte) string

Bytes2String bytes to string

func CamelCaseToSnakeCase added in v0.0.19

func CamelCaseToSnakeCase(str string, delimiter ...string) string

CamelCaseToSnakeCase camelCase To SnakeCase helloWorld/HelloWorld => hello_world

func IsLcfirst added in v0.0.19

func IsLcfirst(str string) bool

IsLcfirst tests whether the given byte b is in lower case

func IsPattern added in v0.0.19

func IsPattern(str string) bool

func IsUcfirst added in v0.0.19

func IsUcfirst(str string) bool

IsUcfirst tests whether the given byte b is in upper case

func Lcfirst added in v0.0.19

func Lcfirst(str string) string

Lcfirst Lcfirst

func Len

func Len(str string) int

Len string length (utf8)

func Match added in v0.0.19

func Match(str, pattern string) bool

func Pad

func Pad(raw string, length int, padStr string, padType int) string

Pad String padding

func Rand

func Rand(n int, tpl ...string) string

RandString random string of specified length, the second parameter limit can only appear the specified character

func RandInt added in v0.0.19

func RandInt(min int, max int) int

RandInt random numbers in the specified range

func RegexExtract added in v0.0.19

func RegexExtract(pattern string, str string) ([]string, error)

RegexExtract extract matching text

func RegexFind added in v0.0.19

func RegexFind(pattern string, str string, n int) [][]int

RegexFind return matching position

func RegexMatch added in v0.0.19

func RegexMatch(pattern string, str string) bool

RegexMatch check for match

func RegexReplace added in v0.0.19

func RegexReplace(pattern string, str, repl string) (string, error)

RegexReplace replacing matches of the Regexp

func RegexReplaceFunc added in v0.0.19

func RegexReplaceFunc(pattern string, str string, repl func(string) string) (string, error)

RegexReplaceFunc replacing matches of the Regexp

func SnakeCaseToCamelCase added in v0.0.19

func SnakeCaseToCamelCase(str string, ucfirst bool, delimiter ...string) string

SnakeCaseToCamelCase snakeCase To CamelCase: hello_world => helloWorld

func String2Bytes

func String2Bytes(s string) []byte

String2Bytes string to bytes

func Substr

func Substr(str string, start int, length ...int) string

Substr returns part of a string

func TrimBOM added in v0.0.19

func TrimBOM(fileBytes []byte) []byte

TrimBOM TrimBOM

func Ucfirst added in v0.0.19

func Ucfirst(str string) string

Ucfirst Ucfirst

func XssClean added in v0.0.19

func XssClean(str string) string

XssClean clean html tag

Types

This section is empty.

Jump to

Keyboard shortcuts

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