It looks like you have your \n\r the wrong way round in your replValues.

replValues[0] is "\n\r", whereas in your String "s" the order is "\r\n"

On Fri, Dec 3, 2010 at 2:18 PM, carlo <[email protected]> wrote:

> Hi Everybody
>
> Tried to find some answers over google, but wasn't successful.
>
> I'm reading an XML-File with an XML-Element including the following
> Attribute:
> repl="\n\r;\v\t"
> which i put in a string-array
> string[] replValues = Attribute["myText"].Value.Split(';');
>
> Now I have a string which looks like:
> string s = "This is\r\nsome Text\r\nwith some line breaks"
>
> I tried to replace all occurences of replValues[0] with replValues[1].
> s = s.replace(replValues[0], replValues[1]);
>
> But it doesn't find anything, and the debugger shows me: replValues[0]
> == "\\n\\r"
> Which of course is not contained in the string, now I'm not sure if
> that is just the debugger escaping, but the string s is displayed
> correctly.
> I even tried to replace the "\\" with a "\" but it doesn't work.
>
> I would appreciate any help, since I'm really stuck with that issue.
> Using C# Asp.Net 3.5 with
>
> Thanks in advance
> Carlo

Reply via email to