You need to sign in to do that
Don't have an account?

Split function not working as desired
Hi All,
I am using split function and new line character to split the long text area field and show them in different lines. It is working fine but it is also adding parentheses around every text in new line. I don't want them to add parentheses around every text. Below is my code.
rEntry.Publisher_URLs__c += ' ' + rC.publisher_Site_Placement_URL__r.Name.split('\n') + ';';
Output:
(sportsgroundgames.com); (womenshealthbase.com); (wwe.com);
Desired Output:
sportsgroundgames.com; womenshealthbase.com; wwe.com;
Can someone help me in removing parentheses. Thanks is advance.
I am using split function and new line character to split the long text area field and show them in different lines. It is working fine but it is also adding parentheses around every text in new line. I don't want them to add parentheses around every text. Below is my code.
rEntry.Publisher_URLs__c += ' ' + rC.publisher_Site_Placement_URL__r.Name.split('\n') + ';';
Output:
(sportsgroundgames.com); (womenshealthbase.com); (wwe.com);
Desired Output:
sportsgroundgames.com; womenshealthbase.com; wwe.com;
Can someone help me in removing parentheses. Thanks is advance.
I have tested that code in my org's developer console, it's working perfect.
do one thing add replaceAll method after splitting Best Regards,
Mithun.
All Answers
Use replaceAll method.
Best Regards,
Mithun.
Thanks for your reply. I used the above and I am getting this error.
Compile Error: line 29:97 no viable alternative at character '"' at line 29 column 97.
Then I replaced double qoutes with single quotes , it is still not working. Please Advice.
Thanks
rEntry.Publisher_URLs__c += ' ' + rC.publisher_Site_Placement_URL__r.Name.split('\n').replaceAll('\\(', '').replaceAll('\\)','') + ';';
and below is the error.
Compile Error: Method does not exist or incorrect signature: [List<String>].replaceAll(String, String) at line 29 column 87
Your help will be highly aprreciated.
Thanks
Here is exact solution. Best Regards,
Mithun.
Still the same error
Method does not exist or incorrect signature: [List<String>].replaceAll(String, String) at line 29 column 87
I have tested that code in my org's developer console, it's working perfect.
do one thing add replaceAll method after splitting Best Regards,
Mithun.
Best Regards,
Mithun.