In Nim, I have a string that I need to split into characters, but each character should be converted to a string.
Right now I have something like:
var d = initTable[string,int]()
for ch in line:
d.mgetOrPut(ch, 0) += 1
This fails, because ch
is a character, not a string. One option is to call initTable
with char,int
, but I would like to know: how can I convert ch
in the example above to a string, so that it can be put into the table?