diff options
| author | Shulhan <ms@kilabit.info> | 2019-06-14 19:02:22 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2019-06-14 19:02:22 +0700 |
| commit | 8d5ffba2d9483f049385d37bc468f2a114548eb0 (patch) | |
| tree | f545e93345f3c4273ec1b962f797bdcbc20dc80b /lib/bytes/bytes.go | |
| parent | 381a0c6e6dfc702ffbbd398abaae356f4e075a0e (diff) | |
| download | pakakeh.go-8d5ffba2d9483f049385d37bc468f2a114548eb0.tar.xz | |
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.
Diffstat (limited to 'lib/bytes/bytes.go')
| -rw-r--r-- | lib/bytes/bytes.go | 48 |
1 files changed, 0 insertions, 48 deletions
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. // @@ -445,30 +421,6 @@ func SkipAfterToken(line, token []byte, startAt int, checkEsc bool) (int, bool) } // -// 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. // If "startat" parameter is less than 0, then it will be set to 0. |
