+ Start a Discussion
amateur1amateur1 

string value into table

hi i have displayed some strings in visualforce page

 

aaaaa-------ggggggggg----------hhhhh it is completely one string

aaaaa-------ddddddddd-----------kkkk   it is completely one string only

 

the values are complete strings

 

 

 

instead of that can i make it into tables like

 

aaaa|gggggg|hhhh

aaaa|dddddd|kkkk

 

 

AdrianCCAdrianCC

Hello!

 

You have 2 options depending on how you what to handle your data.

 

1. you replace the '-------' with '|' and show the strings as they are.

String s = 'aaaaa-------ggggggggg----------hhhhh';
s = s.replace('--------', '|');

 

2. if you want to use an apex:repeat or an apex:datatable then you should use split(). This will give you a List<String> through which you can iterate.

List<String> strList = s.split('-------');

 

Regards,

Adrian