mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 07:17:25 +08:00
Add ParseUint64 function
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
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 len(text) > 0 {
|
||||
return 0
|
||||
@@ -14,3 +14,13 @@ func ParseInt(text string, defaultValue int) int {
|
||||
}
|
||||
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user