github.com/vcilabs/webrpc@v0.5.2-0.20201116131534-162e27b1b33b/schema/var_name.go (about)

     1  package schema
     2  
     3  import (
     4  	"strings"
     5  )
     6  
     7  type VarName string
     8  
     9  // TitleDowncase will downcase the first letter of a string,
    10  // ie. convert a name form 'FirstName' to 'firstName'
    11  func (v VarName) TitleDowncase() string {
    12  	if v == "" {
    13  		return ""
    14  	}
    15  	s := string(v)
    16  	return strings.ToLower(s[0:1]) + s[1:]
    17  }
    18  
    19  // TitleUpcase will upcase the first letter of a string,
    20  // ie. convert a name form 'firstName' to 'FirstName'
    21  func (v VarName) TitleUpcase() string {
    22  	if v == "" {
    23  		return ""
    24  	}
    25  	s := string(v)
    26  	return strings.ToUpper(s[0:1]) + s[1:]
    27  }