I think you can split by "," you'll get the array, and the built strings with 3 pieces + 2 spaces in between.
Hope this works,
var string:String = "favorite1,==,test1,favorite2,==,test2,";
var array:Array = string.split(",==,");
var newString:String = array.join("==");
var resultArray:Array = newString.split(",");
var result:String = resultArray.join("\n");
There may be better solution than this.
Thanks a bunch, this is perfect for what i need it too do. Didnt think to
double split. There will never be that big of a string so this method should
if i had the string favorite,==,test2, favorite,like,test3,
Any idea how i could do ,==, and ,like,?
not getting u .....can u please repeat clearly
Sorry yes let me clarify.
if i had a string
I will get
favorite == test1
As it would not recognise the string Like.
This may help,
//var string:String = "favorite1,==,test1,favorite2,==,test2,";
//case 2 :
var string:String = "favorite,==,test1,favorite2,Like,test2,";//2nd case
var array:Array = string.split(",");
for each(var str:String in array)
if(str == "==" || previousString == "==")
resultString = resultString + str ;
resultString = resultString + "\n" + str
previousString = str;
Message was edited by: rabinprithvi
Thanks for your response. This has been most helpful.