nim - Converting a seq[char] to string -
i'm in situation have seq[char]
, so:
import sequtils var s: seq[char] = toseq("abc".items)
what's best way convert s
string (i.e. "abc"
)? stringifying $
seems give "@[a, b, c]"
, not want.
the efficient way write procedure of own.
import sequtils var s = toseq("abc".items) proc tostring(str: seq[char]): string = result = newstringofcap(len(str)) ch in str: add(result, ch) echo tostring(s)
Comments
Post a Comment