-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Milestone
Description
Hi,
i would like to have a string.coalesce function, that returns the first not empty string.
I think, it's an clean solution for realizing default values.
It exists in T-SQL for example.
// returns the first not empty string of certain strings
func coalesce(values ...string) string {
for _, value := range values {
if value != "" {
return value
}
}
return ""
}
What do you think?
Best regards,
Steffen