|
@ -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 |
|
|
|
|
|
} |