ctype

package
v1.13.10 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: Apache-2.0 Imports: 0 Imported by: 6

Documentation

Index

Constants

View Source
const (
	UPPER     = 0x01       /* upper case letter[A-Z] */
	LOWER     = 0x02       /* lower case letter[a-z] */
	DIGIT     = 0x04       /* digit[0-9] */
	UNDERLINE = 0x08       /* underline[_] */
	XDIGIT    = 0x10       /* xdigit[0-9a-fA-F] */
	EOL       = 0x20       /* [\r\n] */
	ADD       = 0x40       /* [+] */
	SUB       = 0x80       /* [-] */
	MUL       = 0x100      /* [*] */
	DIV       = 0x200      /* [/] */
	LT        = 0x400      /* [<] */
	GT        = 0x800      /* [>] */
	EQ        = 0x1000     /* [=] */
	RDIV      = 0x2000     /* [\\], right-division, anti-slash */
	DOT       = 0x4000     /* [.] */
	COLON     = 0x8000     /* [:], colon */
	PERCENT   = 0x10000    /* [%] */
	AND       = 0x20000    /* [&] */
	OR        = 0x40000    /* [|] */
	SPACE_BAR = 0x80000    /* [ ] */
	LCAP_R    = 0x100000   /* [r] */
	LCAP_T    = 0x200000   /* [t] */
	LCAP_N    = 0x400000   /* [n] */
	LCAP_W    = 0x800000   /* [w] */
	COMMA     = 0x1000000  /* [,] */
	SEMICOLON = 0x2000000  /* [;] */
	TAB       = 0x4000000  /* [\t] */
	QUOT      = 0x8000000  /* ["] */
	BACKTICK  = 0x10000000 /* [`] */
)
View Source
const (
	BLANK                = SPACE_BAR
	TSPACE               = TAB | EOL
	SPACE                = SPACE_BAR | TSPACE
	PATH_SEP             = DIV | RDIV
	ALPHA                = UPPER | LOWER
	FLOAT_FIRST_CHAT     = DIGIT | DOT
	SYMBOL_FIRST_CHAR    = ALPHA
	SYMBOL_NEXT_CHAR     = SYMBOL_FIRST_CHAR | DIGIT
	CSYMBOL_FIRST_CHAR   = ALPHA | UNDERLINE
	CSYMBOL_NEXT_CHAR    = CSYMBOL_FIRST_CHAR | DIGIT
	XMLSYMBOL_FIRST_CHAR = CSYMBOL_FIRST_CHAR
	XMLSYMBOL_NEXT_CHAR  = CSYMBOL_NEXT_CHAR | SUB
	DOMAIN_CHAR          = ALPHA | DIGIT | SUB | ADD | DOT
	BASE64               = ALPHA | DIGIT | ADD | DIV       // [a-zA-Z0-9+/]
	URLSAFE_BASE64       = ALPHA | DIGIT | SUB | UNDERLINE // [a-zA-Z0-9\-_]
)

Variables

This section is empty.

Functions

func Is

func Is(typeMask uint32, c rune) bool

Is checks if a rune meets specified typeMask or not.

func IsCSymbol

func IsCSymbol(str string) bool

IsCSymbol checks specified string meets a C symbol or not.

func IsType

func IsType(typeMask uint32, str string) bool

IsType checks if all runes of a string meet specified typeMask or not.

func IsTypeEx

func IsTypeEx(typeFirst, typeNext uint32, str string) bool

IsTypeEx checks if the first rune of a string meets typeFirst, and the other runes meet typeNext.

func IsXmlSymbol

func IsXmlSymbol(str string) bool

IsXmlSymbol checks specified string meets a XML symbol or not.

func ScanCSymbol added in v1.13.5

func ScanCSymbol(str string) int

ScanCSymbol skips a C symbol and returns its end position. If the string does not start with a C symbol, it returns 0. If there are no other characters after the C symbol, it returns -1.

func ScanType added in v1.13.5

func ScanType(typeMask uint32, str string) int

ScanType scans a string to find a rune that doesn't meet specified typeMask. if not found, it returns -1.

func ScanTypeEx added in v1.13.5

func ScanTypeEx(typeFirst, typeNext uint32, str string) int

func ScanXmlSymbol added in v1.13.5

func ScanXmlSymbol(str string) int

ScanXmlSymbol skips a XML symbol and returns its end position. If the string does not start with a XML symbol, it returns 0. If there are no other characters after the XML symbol, it returns -1.

func SkipCSymbol added in v1.13.5

func SkipCSymbol(str string) string

SkipCSymbol scans a string to skip a C symbol. If the string doesn't start with a C symbol, it returns the origin string.

func SkipTypeEx added in v1.13.5

func SkipTypeEx(typeFirst, typeNext uint32, str string) string

func SkipXmlSymbol added in v1.13.5

func SkipXmlSymbol(str string) string

SkipXmlSymbol scans a string to skip a XML symbol. If the string doesn't start with a XML symbol, it returns the origin string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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