Source File
print.go
Belonging Package
net/http/internal/ascii
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package ascii
import (
)
// EqualFold is [strings.EqualFold], ASCII only. It reports whether s and t
// are equal, ASCII-case-insensitively.
func (, string) bool {
if len() != len() {
return false
}
for := 0; < len(); ++ {
if lower([]) != lower([]) {
return false
}
}
return true
}
// lower returns the ASCII lowercase version of b.
func lower( byte) byte {
if 'A' <= && <= 'Z' {
return + ('a' - 'A')
}
return
}
// IsPrint returns whether s is ASCII and printable according to
// https://tools.ietf.org/html/rfc20#section-4.2.
func ( string) bool {
for := 0; < len(); ++ {
if [] < ' ' || [] > '~' {
return false
}
}
return true
}
// Is returns whether s is ASCII.
func ( string) bool {
for := 0; < len(); ++ {
if [] > unicode.MaxASCII {
return false
}
}
return true
}
// ToLower returns the lowercase version of s if s is ASCII and printable.
func ( string) ( string, bool) {
if !IsPrint() {
return "", false
}
return strings.ToLower(), true
}
The pages are generated with Golds v0.7.3. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |