String Enumeration
BlitzMax Forums/BlitzMax Programming/String Enumeration
| ||
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)? |
| ||
This?Local string_ :String = "BlitzMax tends to rule!" Local char_:String[] = string_.split(" ") Local s:String For s = EachIn char_ Print s Next |
| ||
or maybe you're looking forLocal string_ :String = "BlitzMax tends to rule!" For Local i:Int = 0 Until string_.Length Print Chr(string_[i]) Next |
| ||
@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! |