String Enumeration

BlitzMax Forums/BlitzMax Programming/String Enumeration

beanage(Posted 2010) [#1]
I wonder why this does not work:
Local string_ :String = "BlitzMax tends to rule!"
For Local char_:String = EachIn string_
....

Next

In the past I always got the feeling that internally Strings somehow inherit from Arrays, and therefore I expected this to work... whats your opinion? And, is there a more "esthetic workaround" (just in case thats not an oxymoron :P)?


GfK(Posted 2010) [#2]
This?
Local string_ :String = "BlitzMax tends to rule!"
Local char_:String[] = string_.split(" ")
Local s:String

For  s = EachIn char_
	Print s
Next



Difference(Posted 2010) [#3]
or maybe you're looking for

Local string_ :String = "BlitzMax tends to rule!"

For Local i:Int = 0 Until string_.Length
	Print Chr(string_[i])
Next



beanage(Posted 2010) [#4]
@Gfk: Uh, that was a glitch of hope, but you misunderstood me.. I want to enumerate the characters, not the words. Thanks anyway for joining the discussion :)

<EDIT:> Now, Peter is on the right track! And his soln. is propably the best available atm, thanks!