@@ -25,7 +25,7 @@ type styleInc struct {
2525 Style FormattingStyle
2626}
2727
28- var styles = map [rune ]FormattingStyle {
28+ var styleSigns = map [rune ]FormattingStyle {
2929 '_' : Snake ,
3030 '-' : Kebab ,
3131}
@@ -115,6 +115,36 @@ func SetStyle(text *string, style FormattingStyle, firstSymbol CaseSetting, text
115115 return ""
116116}
117117
118+ func GetFormattingStyleOptions (style string ) (FormattingStyle , CaseSetting , CaseSetting ) {
119+ styleLower := strings .ToLower (style )
120+ var formattingStyle FormattingStyle
121+ firstSymbolCase := ToLower
122+ textCase := NoChanges
123+ switch styleLower {
124+ case string (Camel ):
125+ formattingStyle = Camel
126+ break
127+ case string (Snake ):
128+ formattingStyle = Snake
129+ break
130+ case string (Kebab ):
131+ formattingStyle = Kebab
132+ break
133+ }
134+
135+ runes := []rune (style )
136+ firstSymbolIsUpper := isSymbolIsUpper (runes [0 ])
137+ if firstSymbolIsUpper {
138+ firstSymbolCase = ToUpper
139+ }
140+
141+ if formattingStyle != Camel {
142+
143+ }
144+
145+ return formattingStyle , firstSymbolCase , textCase
146+ }
147+
118148// defineFormattingStyle
119149/* This function defines what formatting style is using in text
120150 * If there are no transitions between symbols then here we have NoFormatting style
@@ -130,11 +160,11 @@ func defineFormattingStyle(text *string) []styleInc {
130160 runes := []rune (* text )
131161 for pos , char := range runes {
132162 // define style and add stats
133- style , ok := styles [char ]
163+ style , ok := styleSigns [char ]
134164 if ! ok {
135165 // 1. Probably current symbol is not a sign and we should continue
136166 if pos > 0 && pos < len (runes )- 1 {
137- charIsUpperCase := isUpper (char )
167+ charIsUpperCase := isSymbolIsUpper (char )
138168 prevChar := runes [pos - 1 ]
139169 prevCharIsUpperCase := unicode .IsUpper (prevChar )
140170 if charIsUpperCase && ! prevCharIsUpperCase {
@@ -149,6 +179,16 @@ func defineFormattingStyle(text *string) []styleInc {
149179 return inclusions
150180}
151181
152- func isUpper (symbol rune ) bool {
182+ func isSymbolIsUpper (symbol rune ) bool {
153183 return unicode .IsUpper (symbol ) && unicode .IsLetter (symbol )
154184}
185+
186+ func isStringIsUpper (str []rune ) bool {
187+ isUpper := true
188+ for _ , r := range str {
189+ if unicode .IsLetter (r ) {
190+ isUpper = isUpper && unicode .IsUpper (r )
191+ }
192+ }
193+ return isUpper
194+ }
0 commit comments