About using juce::String. replaceCharacter()

Hi,
I want to use replaceCharacter() method to replace all the ‘’ to ‘\’.
I used like this:

juce::String temp = temp1.replaceCharacter(’\’,’\\’);
I may made something wrong, I can not get the string I want.
for example , I want to change c:\temp to c:\temp

Best
Leon

Did you try replaceCharacters() - with an s?

Bruce

i think you need to have a quick think about what you’re doing…

replacing a character means changing one character for a different one.
you’re not doing that at all - you’re replacing one character with the same character plus a copy… what you want to do is find all ‘’ and insert another ‘’ after it (as long as it hasn’t already got one).

you could, however, try using replace(…) which replaces a substring rather than a character (because the replacement doesn’t have to be the same size)