From 8d5ffba2d9483f049385d37bc468f2a114548eb0 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 14 Jun 2019 19:02:22 +0700 Subject: ascii: new library for working with ASCII characters This library previously part of bytes package. To make it bytes package consistent (only working with slice of byte), we move all ASCII related constants, variables, and functions into new package. --- lib/bytes/bytes.go | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) (limited to 'lib/bytes/bytes.go') diff --git a/lib/bytes/bytes.go b/lib/bytes/bytes.go index 8a1e94f7..62e7d307 100644 --- a/lib/bytes/bytes.go +++ b/lib/bytes/bytes.go @@ -10,30 +10,6 @@ import ( "reflect" ) -const ( - // ASCIILetters contains list of lower and upper case characters in - // ASCII. - ASCIILetters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - - // ASCIILettersNumber contains list of lower and upper case - // characters in ASCII with numbers. - ASCIILettersNumber = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890" - - // HexaLETTERS contains list of hexadecimal characters in upper cases. - HexaLETTERS = "0123456789ABCDEF" - // HexaLetters contains list of hexadecimal characters in lower and - // upper cases. - HexaLetters = "0123456789abcedfABCDEF" - // Hexaletters contains list of hexadecimal characters in lower cases. - Hexaletters = "0123456789abcedf" -) - -//nolint:gochecknoglobals -var ( - // ASCIISpaces contains list of white spaces in ASCII. - ASCIISpaces = []byte{'\t', '\n', '\v', '\f', '\r', ' '} -) - // // AppendInt16 into slice of byte. // @@ -444,30 +420,6 @@ func SkipAfterToken(line, token []byte, startAt int, checkEsc bool) (int, bool) return p, false } -// -// ToLower convert slice of bytes to lower cases, in places. -// -func ToLower(data *[]byte) { - for x := 0; x < len(*data); x++ { - if (*data)[x] < 'A' || (*data)[x] > 'Z' { - continue - } - (*data)[x] += 32 - } -} - -// -// ToUpper convert slice of bytes to upper cases, in places. -// -func ToUpper(data *[]byte) { - for x := 0; x < len(*data); x++ { - if (*data)[x] < 'a' || (*data)[x] > 'z' { - continue - } - (*data)[x] -= 32 - } -} - // // TokenFind return the first index of matched token in line, start at custom // index. -- cgit v1.3