Fix corner case when all chars are uppercase or lowercase
This commit is contained in:
@@ -16,6 +16,7 @@ proc toSnakeCase*(str: string): string =
|
|||||||
elif ch in {'-', '_', '.', '+'}:
|
elif ch in {'-', '_', '.', '+'}:
|
||||||
if result.len > 0 and result[^1] != '_':
|
if result.len > 0 and result[^1] != '_':
|
||||||
result.add '_'
|
result.add '_'
|
||||||
|
prv = ch
|
||||||
|
|
||||||
proc fromSnakeCase*(str: string): string =
|
proc fromSnakeCase*(str: string): string =
|
||||||
## Convert from SNAKE_CASE to camelCase
|
## Convert from SNAKE_CASE to camelCase
|
||||||
|
|||||||
Reference in New Issue
Block a user