I have String tokens separated by $$
which are list of particulars which are further separated by comma (e.g. Peter Adams,255 Jhonson Street, NY,74322 $$ Mary Luther,54 Eglinton Ave.,Mississauga,ON L5A1W6
)
I want to display above in following way
Name : Peter Adams
Addr :255 Jhonson Street
City : NY
Pincode :74322
Name : Mary Luther
Addr :54 Eglinton Ave.
City :Mississauga
Pincode :ON L5A1W6
in BIRT output
I have tried using following code
var myexp =/[$$]/;
var match = myexp.exec(dataSetRow["SDR"]);
if(match !=null)
{
array=dataSetRow["SDR"].split("$$");
//dataSetRow["SDR"] ="x";
var string=null;
for(var i=0; i<array.length; i++)
{
string+=array[i]+"\n\n";
}
dataSetRow["SDR"]=string.substring(4,string.length);
}
else
{
dataSetRow["SDR"]=dataSetRow["SDR"];
}
which display string tokens as follows
Peter Adams,255 Jhonson Street, NY,74322
Mary Luther,54 Eglinton Ave.,Mississauga,ON L5A1W6
Can any one give some suggestion?