String to Char Array function, anyone?

BlitzMax Forums/BlitzMax Beginners Area/String to Char Array function, anyone?

Does BlitzMax have a function to convert a string to a string array?

Anyone familiar with microsoft dotnet will know one can do something like:
string[] strMyText = "Make me an string array".ToCharArray();

Whats the equvilant of ToCharArray() for BlitzMax?

TIA,
pappavis.

Ah - is this a BMax question? If not then B3D has no such direct command.

string.ToCString()

Incidently, you might not really have to, as strings are indexable / slicable already.

So you could just do strMyText[0..1] and you'll get an "M", or strMyText[0..4] and get "Make".

Oops, misread the question, there doesn't seem to be a ToBytes or ToShorts methods in BlitzMax.

Don't know if this is what you're wanting, but you can access each character's ASCII code by accessing the string like an array.
Local MyString:String = "Hello World!"

For Local t:Int = 0 To Len(MyString) - 1
 Print Chr(MyString[t])+" "+MyString[t]
Next

If you want to make an actual array of strings with each element conatining one character of another string, you could do something like this
Local MyString:String = "Hello World!"
Local MyStringArray:String[]

MyStringArray = New String[Len(MyString)]
For Local t = 0 To Len(MyString)-1
 MyStringArray[t] = Chr(MyString[t])
Next

For t = 0 To Len(MyString) - 1
 Print MyStringArray[t]
Next