23 lines
329 B
Go
23 lines
329 B
Go
package operation
|
|
|
|
import (
|
|
"fmt"
|
|
"strconv"
|
|
)
|
|
|
|
func convertNumber(v interface{}) int {
|
|
s := fmt.Sprint(v)
|
|
v2, _ := strconv.ParseFloat(s, 64)
|
|
return int(v2)
|
|
}
|
|
|
|
func convertString(v interface{}) string {
|
|
switch v.(type) {
|
|
case string:
|
|
return v.(string)
|
|
case []byte:
|
|
return string(v.([]byte))
|
|
}
|
|
return fmt.Sprint(v)
|
|
}
|