You need to sign in to do that
Don't have an account?
Raj R.
How to replace string commas from a string using replaceAll()?
Hi,
I have a class that is grabs Opportunities, places them into a csv file, and then sends an email to a particular email address.
There is a Opportunity.CustomField1 which is a text field that can is populated as such:
I tried doing this but failed
String x = Op.CustomField1;
x.replaceAll(',', ';');
Essentially when the CustomField1 has semicolon (;) character everything works fine, but when there is a comma (,) to separate the values, then the CSV file is messed up because the columns are not aligned properly.
How can I use x.replaceAll() to replace all commas with a semicolon in the customField1?
I have a class that is grabs Opportunities, places them into a csv file, and then sends an email to a particular email address.
There is a Opportunity.CustomField1 which is a text field that can is populated as such:
- Test, Test, Test,
- Test; Test; Test;
I tried doing this but failed
String x = Op.CustomField1;
x.replaceAll(',', ';');
Essentially when the CustomField1 has semicolon (;) character everything works fine, but when there is a comma (,) to separate the values, then the CSV file is messed up because the columns are not aligned properly.
How can I use x.replaceAll() to replace all commas with a semicolon in the customField1?
Static method returns a string which you need to assign it back to your variable.
Hope it helps.,
Cheers,
Thanks,
balaji
All Answers
Static method returns a string which you need to assign it back to your variable.
Hope it helps.,
Cheers,
Thanks,
balaji
replaceAll is a Static string method returns a string which you need to assign it back to your variable.
missed to type replaceAll which brings a wrong impression to the statement
Cheers.,
Cheers,
http://www.salesforce.com/us/developer/docs/dbcom_apex250/Content/apex_methods_system_string.htm