diff --git a/const.go b/const.go index bde248b..4bdefb1 100644 --- a/const.go +++ b/const.go @@ -1,3 +1,3 @@ package gostring -const Version = "1.0.9" +const Version = "1.0.10" diff --git a/get.go b/get.go new file mode 100644 index 0000000..4f96625 --- /dev/null +++ b/get.go @@ -0,0 +1,15 @@ +package gostring + +func GetDefault(key, defVal any) any { + if key != nil { + return key + } + return defVal +} + +func GetStringDefault(key, defVal string) string { + if key != "" { + return key + } + return defVal +}