Chaiscript, how to convert a char to a string

146 views Asked by At

I need to loop every characters of the string. Whether I use a for loop or a range, I get stuck with characters and I can't convert them back to a string.

var str = "abcd"

var a = str[0]
var b = str[1]

print(a.to_string())
print(join([a,b],""))

Output:

97
9798

How to I bring that back to a string?

Thank you

1

There are 1 answers

0
user1766050 On BEST ANSWER

You can loop your string using str.Left(i). Then each loop your string becomes str.Right(str.size()-1)

This returns a string.