Skip to content

Commit

Permalink
Make nimIdentNormalize return "" when passed ""; fixes nim-lang#19067
Browse files Browse the repository at this point in the history
  • Loading branch information
EliteTK committed Oct 29, 2021
1 parent 7ba2659 commit 34bb30c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/pure/strutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,9 @@ func nimIdentNormalize*(s: string): string =
runnableExamples:
doAssert nimIdentNormalize("Foo_bar") == "Foobar"
result = newString(s.len)
if s.len > 0:
result[0] = s[0]
if s.len == 0:
return
result[0] = s[0]
var j = 1
for i in 1..len(s) - 1:
if s[i] in {'A'..'Z'}:
Expand Down

0 comments on commit 34bb30c

Please sign in to comment.