Update snake.go
This commit is contained in:
parent
d8275f2535
commit
f2ad438e9e
2
snake.go
2
snake.go
@ -13,7 +13,7 @@ func ToSnake(s string) string {
|
|||||||
for i, v := range s {
|
for i, v := range s {
|
||||||
// treat acronyms as words, eg for JSONData -> JSON is a whole word
|
// treat acronyms as words, eg for JSONData -> JSON is a whole word
|
||||||
preIsCapital := false
|
preIsCapital := false
|
||||||
if i - 1 > 0 {
|
if i > 0 {
|
||||||
w := s[i-1]
|
w := s[i-1]
|
||||||
preIsCapital = w >= 'A' && w <= 'Z'
|
preIsCapital = w >= 'A' && w <= 'Z'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user