You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
363 B
26 lines
363 B
2 years ago
|
package toolm
|
||
|
|
||
|
func StringDefault(value string, defValues ...string) string {
|
||
|
if value != "" {
|
||
|
return value
|
||
|
}
|
||
|
for _, v := range defValues {
|
||
|
if v != "" {
|
||
|
return v
|
||
|
}
|
||
|
}
|
||
|
return ""
|
||
|
}
|
||
|
|
||
|
func Int64Default(value int64, defValues ...int64) int64 {
|
||
|
if value != 0 {
|
||
|
return value
|
||
|
}
|
||
|
for _, v := range defValues {
|
||
|
if v != 0 {
|
||
|
return v
|
||
|
}
|
||
|
}
|
||
|
return 0
|
||
|
}
|