Using .Replace with strings not working

I don’t have a specific question but I am getting a piece of text and then trying to replace one part of this paragraph with a different string. However, the replace is not working and the text remains the same. Any idea why? TIA

How are you using the Replace function? Can you give us an example of the text and what you want replaced?

@DanielMitchell the text is actually some html code and I want to replace a part of it that says “Please review the missing fields reports” with a different line

That should work just fine, assuming you have your html code stored as a string. How exactly is your replace set up? How are you using the revised string?

The code is stored as a string, I checked that. I have tried using the replace with two string variables as well as the two strings written out themselves. Neither has worked. Might be doing something else wrong elsewhere.

Can you share your xaml and the input file? I can try and see what is going amiss.

String.Replace is case sensitive which I’ve found to be a common error in our code. Is it possible sometimes the string being replaced contains upper case and other times those letters are lower case?

I usually make sure I convert everything using String.ToUpper whenever using replace to avoid this issue.

1 Like

I cannot due to some of the information. Sorry, but thanks

The cases seem to match but maybe not the white space, I’ll check it out

It was a whitespace issue. It is resolved now

The usual suspects. Whitespace, and cases. :stuck_out_tongue: