Questions tagged [replaceall]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
45 views

String.replaceAll not able to replace String escape character

While making an API Call, my json String is containing \, which I want to remove. But I am not able to do so, by using the replaceAll method of String class. Can anyone please help? The json request ...
1
vote
2answers
21 views

Why can't I apply replaceAll in my controller function?

I have the following component class, whose function is solely to modify a string for an email template. It works fine, inserting the concatenated string into the email. public class ...
0
votes
1answer
71 views

Replace single quotes

I need to replace single quotes. However, I cannot use the " double quote character. Therefore, I cannot do something like this: String s = "Hello 'thanks' bye"; s = s.replaceAll("'", "\\'"); ...
0
votes
3answers
144 views

replace ' with \' in apex code

i have string variable called "Identifier" which has apostrophe in it. example: Identifier = "string's length" i need to replace this apostrophe with "\'" the result should be Identifier = "string\'...
0
votes
2answers
41 views

Replace + Sign by Underscore

Trying to replace a character '+' with underscore. Tried: String s = 'Happy+Me'; System.debug(s.replaceAll('\\+', '_'); System.debug(s.replaceAll('/\[+]', '_'); Still gives me 'Happy+Me' result. ...
1
vote
1answer
205 views

String Class normalizeSpace() and replaceAll() doesn't work with the Rich text area field

Does anybody know why the normalizeSpace() or replaceAll() doesn't work with my rich text area field? I tried entering same value that I have on the rich text area and manually adding it on a variable(...
1
vote
1answer
327 views

Replace String with Wildcard

Is it possible to replaceall on a string using wildcards? For example string adder; adder = '[Test | 123 ! xyz]'; string replaced; replaced = adder.replaceall('|%!',''); System.AssertEquals(...
2
votes
1answer
106 views

Regex does not work on incoming mail

I'm trying to delete gmail history before creating a case comment. The line of code causing the problem seems to be .replaceAll('On\\s.+\\sat\\s.+\\s<\\s*\\r*.+@.+>\\swrote:(.|\\n|\\r)*','') ...
0
votes
1answer
159 views

Replace double character with single in string

I have to replace double semicolon (;;) in a string with single comma(,) in an apex class. Can someone help me?
0
votes
2answers
644 views

Simple APEX String Replacement - can't unencode quotation marks

I've tried quite a few different methods to unencode a simple string but nothing's turning up. That's the end of my API call, using a regex solution I found online, although it's not working out. ...
2
votes
2answers
57 views

Replaceall() function working weird

I have a requirement where I need to format 'Phone Number' field which is of type 'Phone'. It should not allow some of the special characters like %$#@*&, so am trying to replace each character ...
0
votes
1answer
399 views

Translate spanish characters to english for field values

I have a requirement to translate few predetermined spanish characters to english in field values of different custom objects. I have tried to create a generic code. can someone please let me know ...
2
votes
2answers
655 views

Issue with the string.replace method in salesforce

I have a string (1 and 2) Or (3 and 4) the format of the () can be changed because it is auto generated in the filter of the reports. and i do have four conditions that 1) Age = '60' 2) FirstName = ...
4
votes
1answer
2k views

How to remove ( from the string

I have a string value where I am getting the a integer with ')' I want to remove the ')' have the value separated from all the unwanted special characters. Do any one here have any idea how can I ...
7
votes
1answer
646 views

How to replace 'MyFirstName' by 'My First Name'

Is there any easy way, by using regex and replaceAll method, to tranform MyFirstName by My First Name. I know I could loop through each character but I was wondering if it was possible to do that in ...