

Well… as I had mentioned in one of my earlier posts, I am basically a Java programmer and hence when it comes to programming in ActionScript, I realize that the bits of code that I take for granted in Java are things I need to ponder about a little when they are to be coded in AS3. One such challenge was splitting strings. Now, in hindsight, it sounds so simple; however, at that time, I spent a good three hours in trying to figure this out. And, at the end of my three hours of frantic syntax searching and racking out my brains, I discovered the split() function in AS3. Here’s how to use this function.
The syntax for this function is: split(delimiter:String, [limit:Number]) : Array. The first parameter—delimiter:String—would be the string or character at which I want to split a string called my_string, and the second one—limit:Number—would be the optional parameter that is used for specifying the number of items that are to be placed into the array.
Now, that you know what the syntax for the split() function is, try it and check the output for yourself. You can use this function when you want to parse out some data or want to remove or replace a string. Furthermore, you may want to check out the join() function as well if you seeking to write a piece of AS3 code for replacing a part of a long string.
If you would like to make a comment, please fill out the form below.
| Cox on-demand ||| Verizon Offers ||| Comcast cable tv |
wtf?
Isn’t this the same syntax as one would use when coding in java?
So you say you are a java developer? And what was so hard to figure out here starting from java’s String[] split(String regex,int limit) ?