Source File
parse.go
Belonging Package
net
= string()
.data = .data[0:0]
= true
}
return
}
func ( *file) () ( string, bool) {
if , = .getLineFromData(); {
return
}
if len(.data) < cap(.data) {
:= len(.data)
, := io.ReadFull(.file, .data[:cap(.data)])
if >= 0 {
.data = .data[0 : +]
}
if == io.EOF || == io.ErrUnexpectedEOF {
.atEOF = true
}
}
, = .getLineFromData()
return
}
func ( string) (*file, error) {
, := os.Open()
if != nil {
return nil,
}
return &file{, make([]byte, 0, 64*1024), false}, nil
}
func ( string) ( time.Time, int64, error) {
, := os.Stat()
if != nil {
return time.Time{}, 0,
}
return .ModTime(), .Size(), nil
}
func ( string, string) []string {
:= make([]string, 1+countAnyByte(, ))
:= 0
:= 0
for := 0; < len(); ++ {
if bytealg.IndexByteString(, []) >= 0 {
if < {
[] = [:]
++
}
= + 1
}
}
if < len() {
[] = [:]
++
}
return [0:]
}
func ( string) []string { return splitAtBytes(, " \r\t\n") }
const big = 0xFFFFFF
func ( string) ( int, int, bool) {
= 0
for = 0; < len(); ++ {
if '0' <= [] && [] <= '9' {
*= 16
+= int([] - '0')
} else if 'a' <= [] && [] <= 'f' {
*= 16
+= int([]-'a') + 10
} else if 'A' <= [] && [] <= 'F' {
*= 16
+= int([]-'A') + 10
} else {
break
}
if >= big {
return 0, , false
}
}
if == 0 {
return 0, , false
}
return , , true
}
func ( []byte) {
for , := range {
if 'A' <= && <= 'Z' {
[] += 'a' - 'A'
}
}
}
func (, string) bool {
if len() != len() {
return false
}
for := 0; < len(); ++ {
if lowerASCII([]) != lowerASCII([]) {
return false
}
}
return true
}
func ( io.Reader) ( []byte, error) {
:= make([]byte, 1024)
for {
, := .Read()
= append(, [:]...)
if == io.EOF {
return , nil
}
if != nil {
return nil,
}
}
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin 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 @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |