...

Source file src/github.com/gobuffalo/flect/capitalize.go

Documentation: github.com/gobuffalo/flect

     1  package flect
     2  
     3  import "unicode"
     4  
     5  // Capitalize will cap the first letter of string
     6  //	user = User
     7  //	bob dylan = Bob dylan
     8  //	widget_id = Widget_id
     9  func Capitalize(s string) string {
    10  	return New(s).Capitalize().String()
    11  }
    12  
    13  // Capitalize will cap the first letter of string
    14  //	user = User
    15  //	bob dylan = Bob dylan
    16  //	widget_id = Widget_id
    17  func (i Ident) Capitalize() Ident {
    18  	if len(i.Parts) == 0 {
    19  		return New("")
    20  	}
    21  	runes := []rune(i.Original)
    22  	runes[0] = unicode.ToTitle(runes[0])
    23  	return New(string(runes))
    24  }
    25  

View as plain text