ctype

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 0 Imported by: 0

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
	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 判断某个字符是否属于该 typeMask 对应的字符类型 typeMask: 字符类型掩码

func IsCSymbol

func IsCSymbol(str string) bool

IsCSymbol 判断字符串是否符合C语言的标识符

func IsType

func IsType(typeMask uint32, str string) bool

IsType 判断字符串是否属于该 typeMask 对应的字符类型 typeMask: 字符类型掩码 NOTE: 空字符串返回 false

func IsTypeEx

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

IsTypeEx 判断字符串是否属于该 typeMask 对应的字符类型 typeFirst: 第一个字符的类型 typeNext: 除第一个字符外的其他字符的类型 NOTE: 空字符串返回 false

func IsXmlSymbol

func IsXmlSymbol(str string) bool

IsXmlSymbol 判断字符串是否符合XML的标识符

Types

This section is empty.

Jump to

Keyboard shortcuts

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