diff options
| author | Shulhan <ms@kilabit.info> | 2025-01-23 03:40:50 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2025-01-23 03:41:10 +0700 |
| commit | 2a0694d2fa577574b505c4635eb8a824eaf88ddc (patch) | |
| tree | cce840739c7f59893c3a6a65a1600f9f857c484e /lib/bytes/bytes.go | |
| parent | 605d847b236dde031a2e387e74298d66a27b5e0a (diff) | |
| download | pakakeh.go-2a0694d2fa577574b505c4635eb8a824eaf88ddc.tar.xz | |
all: use for-range with numeric
Go 1.22 now support for-range on numeric value.
Diffstat (limited to 'lib/bytes/bytes.go')
| -rw-r--r-- | lib/bytes/bytes.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/bytes/bytes.go b/lib/bytes/bytes.go index ae1c9234..f0f55555 100644 --- a/lib/bytes/bytes.go +++ b/lib/bytes/bytes.go @@ -154,9 +154,9 @@ func InReplace(text, allowed []byte, c byte) []byte { } var found bool - for x := 0; x < len(text); x++ { + for x := range len(text) { found = false - for y := 0; y < len(allowed); y++ { + for y := range len(allowed) { if text[x] == allowed[y] { found = true break @@ -207,7 +207,7 @@ func IsTokenAt(text, token []byte, p int) bool { return false } - for x := 0; x < tokenlen; x++ { + for x := range tokenlen { if text[p] != token[x] { return false } @@ -370,7 +370,7 @@ func SplitEach(data []byte, n int) (chunks [][]byte) { rows = (size / n) total int ) - for x := 0; x < rows; x++ { + for range rows { chunks = append(chunks, data[total:total+n]) total += n } |
