You need to sign in to do that
Don't have an account?
Fe Pradella
ReplaceAll with Brackets
Hi all!
I'm trying to replace an information with [ from JSON (String)..
From:
"name":[
To:
"name_list":[
I tried couple like:
sResp = SResp.replaceAll('\"name\":\\[', '\"name_list\":\\[');
Nothing seems to work since I cannot get this list after during the execution.
Thanks!!
I'm trying to replace an information with [ from JSON (String)..
From:
"name":[
To:
"name_list":[
I tried couple like:
sResp = SResp.replaceAll('\"name\":\\[', '\"name_list\":\\[');
Nothing seems to work since I cannot get this list after during the execution.
Thanks!!
The replaceAll(String regExp, String replacement) method replaces each substring of a string that matches the regular expression regExp with the replacement sequence replacement (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm).
You should better use the replace(String target, String replacement) method.
For each occurence of the target, the replacement will be used. Let me know if it helped you.
Have a good day,
Valentin
Could you show more of your code or at least an example of it ?
Have you tried to debug the execution and the results ?