Wednesday, November 9, 2011

Splitting strings in action script.

I used the following code to split the string in my code:

var lv_string:String;
lv_string = "[RC=200] URL http://www.google.com called successfully";
var lt_string:Array = lv_string.split("URL");
lv_string = lt_string[1];
lt_string = lv_string.split(" ");

Within the bracket we can specify the delimiter on the basis of which we split the string and put it in an array. We can access the value from the array. ie. lt_string[1] to access the url, etc.

Hope this will save some trouble.

No comments:

Post a Comment