mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 12:42:34 +02:00
17 lines
257 B
Go
17 lines
257 B
Go
package strutils
|
|
|
|
import (
|
|
"errors"
|
|
"strconv"
|
|
|
|
E "github.com/yusing/go-proxy/internal/error"
|
|
)
|
|
|
|
func Atoi(s string) (int, E.Error) {
|
|
val, err := strconv.Atoi(s)
|
|
if err != nil {
|
|
return val, E.From(errors.Unwrap(err)).Subject(s)
|
|
}
|
|
|
|
return val, nil
|
|
}
|