11 lines
184 B
Go
11 lines
184 B
Go
package string
|
|
|
|
// EmptyIfNil returns either the dereferenced string, or "" if the pointer is
|
|
// nil.
|
|
func EmptyIfNil(sp *string) string {
|
|
if sp == nil {
|
|
return ""
|
|
}
|
|
return *sp
|
|
}
|