nim-json-serialization/tests/utils.nim

13 lines
283 B
Nim
Raw Normal View History

2018-12-17 23:01:06 +00:00
import
strutils
proc dedent*(s: string): string =
var s = s.strip(leading = false)
var minIndent = 99999999999
for l in s.splitLines:
let indent = count(l, ' ')
if indent == 0: continue
if indent < minIndent: minIndent = indent
result = s.unindent(minIndent)