-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathto_case.go
61 lines (49 loc) · 1.49 KB
/
to_case.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package namecase
// ToUpperSpace to XX YY ZZ
func ToUpperSpace(s string) string {
return parseNamecase(s).FormatSnake(upperWordCase, " ")
}
// ToLowerSpace to xx yy zz
func ToLowerSpace(s string) string {
return parseNamecase(s).FormatSnake(lowerWordCase, " ")
}
// ToUpperStrike to XX-YY-ZZ
func ToUpperStrike(s string) string {
return parseNamecase(s).FormatSnake(upperWordCase, "-")
}
// ToLowerStrike to xx-yy-zz
func ToLowerStrike(s string) string {
return parseNamecase(s).FormatSnake(lowerWordCase, "-")
}
// ToUpperSnake to XX_YY_ZZ
func ToUpperSnake(s string) string {
return parseNamecase(s).FormatSnake(upperWordCase, "_")
}
// ToLowerSnake to xx_yy_zz
func ToLowerSnake(s string) string {
return parseNamecase(s).FormatSnake(lowerWordCase, "_")
}
// ToPascal to XxYyZz
func ToPascal(s string) string {
return ToUpperHump(s)
}
// ToCamel to xxYyZz
func ToCamel(s string) string {
return ToLowerHump(s)
}
// ToUpperHump to XxYyZz
func ToUpperHump(s string) string {
return parseNamecase(s).FormatCamel(titleWordCase, titleWordCase)
}
// ToLowerHump to xxYyZz
func ToLowerHump(s string) string {
return parseNamecase(s).FormatCamel(lowerWordCase, titleWordCase)
}
// ToUpperHumpInitialisms to XxYyZzID
func ToUpperHumpInitialisms(s string) string {
return parseNamecase(s).FormatCamel(initialismsWordCase, initialismsWordCase)
}
// ToLowerHumpInitialisms to xxYyZzID
func ToLowerHumpInitialisms(s string) string {
return parseNamecase(s).FormatCamel(lowerWordCase, initialismsWordCase)
}