Given this line (with \ n), how can I remove it from all returns?

Here's the line:

\n\n\t\thttp://www.linkedin.com/in/ckenworthy\n\n\t

How can I separate everything so that I just finish:

http://www.linkedin.com/in/ckenworthy

I tried the following:

string value = doc.XPathSelectElement("/ipb/profile/contactinformation/contact[title/text() = 'LinkedIn']/value").Value;
                value = value.Replace(Environment.NewLine, "");
                return value;

But I always end the first line that I posted there. Thank!

+3
source share
2 answers

value.Trim()will probably do exactly what you want. It will remove all whitespace from the beginning and end of the line.

The reason Environment.NewLinemay not work, because its meaning depends on whether you work on Windows, Unix or Mac, but it really doesn’t matter if you get a line from a remote system - the remote system will still return the same line separator ( '\n'in this case).

+6
source

Try ...

value.Trim()
+3

Source: https://habr.com/ru/post/1753101/


All Articles