Merge branch 'master' of github.com:Araq/Nimrod

This commit is contained in:
dom96 2011-05-14 20:35:17 +01:00
commit 4fd42d5150
43 changed files with 262 additions and 177 deletions

View file

@ -649,7 +649,8 @@ proc nl(s: var string, ml: bool) =
proc escapeJson*(s: string): string =
## Converts a string `s` to its JSON representation.
result = "\""
result = newStringOfCap(s.len + s.len shr 3)
result.add("\"")
for x in runes(s):
var r = int(x)
if r >= 32 and r <= 127: