github.com/seeker-insurance/kit@v0.0.13/coerce/string.go (about)

     1  package coerce
     2  
     3  //String converts strings, []bytes, and []runes to strings
     4  func String(v interface{}) (string, bool) {
     5  	switch v := v.(type) {
     6  	default:
     7  		return "", false
     8  	case string:
     9  		return v, true
    10  	case []byte:
    11  		return string(v), true
    12  	case []rune:
    13  		return string(v), true
    14  	}
    15  }