I have a string that is retrieved from a socket. I display this string as the text of a button. Some strings contains a '\' which doesn't get printed because it's an escape character. So, I want to find all '\' and replace it with a "\\" so it will show up on the button.
The code below gets an error on the first line:
ERROR: newline in constant
index = OrigString->IndexOf('\');
if (index != -1)
substring1 = OrigString->Substring(0,index);
substring2 = OrigString->Substring(index+1);
OrigString = String::Concat(substring1, S'\', substring2);
What can I do to resolve this error?
1) find index of '\' in string
2) split the string into 2 strings at index
3) Concatenate string1, '\', string2