Source File
decode_number.go
Belonging Package
google.golang.org/protobuf/internal/encoding/json
package json
import (
)
if < len() && isNotDelim([]) {
return 0, false
}
return , true
}
func ( []byte) (numberParts, bool) {
var bool
var []byte
var []byte
var []byte
:=
if len() == 0 {
return numberParts{}, false
}
if [0] == '-' {
= true
= [1:]
if len() == 0 {
return numberParts{}, false
}
}
switch {
= [1:]
case '1' <= [0] && [0] <= '9':
=
:= 1
= [1:]
for len() > 0 && '0' <= [0] && [0] <= '9' {
= [1:]
++
}
= [:]
default:
return numberParts{}, false
}
if len() >= 2 && ([0] == 'e' || [0] == 'E') {
= [1:]
=
:= 0
if [0] == '+' || [0] == '-' {
= [1:]
++
if len() == 0 {
return numberParts{}, false
}
}
for len() > 0 && '0' <= [0] && [0] <= '9' {
= [1:]
++
}
= [:]
}
return numberParts{
neg: ,
intp: ,
frac: bytes.TrimRight(, "0"), // Remove unnecessary 0s to the right.
exp: ,
}, true
}
if > {
return "", false
}
const = 20 // Max uint64 value has 20 decimal digits.
if + > {
return "", false
}
if > 0 {
return "", false
}
:= +
if < 0 {
return "", false
}
![]() |
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. |