mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Add ParseUint64 function
This commit is contained in:
parent
36a31771f1
commit
c89b4fd18b
|
@ -5,7 +5,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func ParseInt(text string, defaultValue int) int {
|
func ParseInt(text string, defaultValue int) int {
|
||||||
count, parseError := strconv.ParseUint(text, 10, 64)
|
count, parseError := strconv.ParseInt(text, 10, 64)
|
||||||
if parseError != nil {
|
if parseError != nil {
|
||||||
if len(text) > 0 {
|
if len(text) > 0 {
|
||||||
return 0
|
return 0
|
||||||
|
@ -14,3 +14,13 @@ func ParseInt(text string, defaultValue int) int {
|
||||||
}
|
}
|
||||||
return int(count)
|
return int(count)
|
||||||
}
|
}
|
||||||
|
func ParseUint64(text string, defaultValue uint64) uint64 {
|
||||||
|
count, parseError := strconv.ParseUint(text, 10, 64)
|
||||||
|
if parseError != nil {
|
||||||
|
if len(text) > 0 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return defaultValue
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue