Questions tagged [replace]
The replace tag has no usage guidance.
19 questions
0
votes
3
answers
77
views
How to update null records in JSON
I'm currently working on the below JSON. Sometimes records in matches return null, instead of record. And null will appear anywhere within the array
{
"status": "success",
...
0
votes
1
answer
920
views
Apex replace \" in string
String jsonString = 'Error \"fatal\"';
String jsonString2 = jsonString.replaceAll('\\"', '');
System.assertEquals(jsonString, 'Error fatal', 'Assertion failed');
The jsonString ...
-1
votes
1
answer
2k
views
Replace String inside json inside Array Javascript
Hello guys I have a js file that has a list of json that have the next structure:
[{"label":"9312 - Item1", "value":"9312"},
{"label":"9313 -...
0
votes
1
answer
177
views
ReplaceAll does not function Apex
Hello everybody I am managing data from a LWC form where the user inputs some data and I pass it to validate into an apex class. This validation manages the format of a date time value: I want the ...
0
votes
1
answer
1k
views
Regex to find dd/mm/yyyy
I have a pretty simple code and in one case it works, and not in all the case, I wanted to know what I'm missing
I'm trying to match a date in this format dd/mm/yyyy
This is my code:
String d = '20/03/...
0
votes
2
answers
308
views
Remove spaces and accents from a value field to put it in a From Email Adress field - dynamic sender profile
I need to remove spaces and accents (special characters) and capital letters from the 'From Email Address' field in the sender profile. Indeed, I would like to compose a dynamic From Email Address in ...
0
votes
1
answer
31
views
Modify string value in soql list and add back to list
I have a VFP which functions as a CSV download. In my controller I return a simple SOQL list from a custom Customer object. I need to modify the Name being returned to remove all commas and then add ...
0
votes
2
answers
7k
views
Removing leading zeroes in Date String
I have checked a number of posts and regex examples but for some reason I can't get the leading 0's to be removed from the date string below. Can anyone see what I am doing wrong?
wanted result: 4/6/...
0
votes
1
answer
474
views
Replace double quotes in dataview Bounce
I'm trying to replace double quotes in "SMTPMessage" field of Bounce dataview in Marketing Cloud. But I've entered in several ways, but the quotes do not disappear.
What I did so far is this ...
0
votes
1
answer
980
views
Replace escaped quotes
I want to replace all escaped quotes, but leave default quotes. How can i do it?
string s1 = '"five1,five2", six ,seven,"eig\"ht1,eight2","nine",,eleven';
String ...
0
votes
1
answer
4k
views
Replacing text in lightning email template from apex
I have an Email template which looks like that :
-----------------------
Name : {ContactName}
Account : {AccountName}
{price} : {Cost}
Date: {MinDate}
-------------
I'm using the email template to ...
0
votes
1
answer
593
views
Replace Subject fields on Lightning Email Template
I'm having problems with replace() operations of text that I have in Subject of my Email Template.
Subject is like: A - B - C
My code is:
EmailTemplate eTemplate = newEmail.searchForEmailTemplate('...
0
votes
0
answers
665
views
Unable to parse Json with special character inside Apex [duplicate]
I need to parse the below JSON in salesforce apex. In the message value, special character is not allowing to parse. Added image of JSON parser online.
Javascript replace wont work in apex
Ex: ...
0
votes
1
answer
375
views
I need to replace white space to either side of a word
I am pulling a string of text from a DE. One of the text strings contains the hyphenated word t-shirt, which ends up being split over two lines.
I want to search the text string for a hyphen, then ...
0
votes
1
answer
750
views
Replace function - SQL - Data Extension
I have a data extension with a column titled 'Email Name'. My reporting I have it pipe (|) delimited into a .txt file. When the 'Email Name' column comes in, some values have spaces in the front for ...
4
votes
1
answer
4k
views
Using String.replaceAll() to remove character combination
I need to remove all redundant hyphens in a given string, e.g.: "Bla----Bla---Bla--Bla" to "Bla-Bla-Bla-Bla", using as little code as possible.
At the moment I've implemented this:
...
1
vote
2
answers
5k
views
Replace character in string in specific position (ie not first, not all)
I would like to replace one character in a string with an uppercase of the same character. Is there an elegant way to do this?
Eg I have 'Donald Mcdonald' and I would like to uppercase the first 'd' ...
0
votes
0
answers
1k
views
Error escaping double quotes in large JSON string in Apex
I have large JSON response that I am trying to escape all instances of strings that are problematic for deserialization but am having some issues.
Using .replaceAll works but that throws a "Regex too ...
1
vote
1
answer
13k
views
Using replace() to remove a value from an array in LWC with a RegExp
I just want to remove a value from an Array in LWC using the method replace with RegExp.
@track myList = ['a', 'b', 'c'];
@track removeValue = 'b';
if (this.myList.includes(this.removeValue)) {
...