Here's the string:
\n\n\t\thttp://www.linkedin.com/in/ckenworthy\n\n\t
How can I strip everything so I only end up with:
http://www.linkedin.com/in/ckenworthy
I've 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 up with the first line I posted up there. Thank you!
value.Trim()
will probably do exactly what you want. It will remove all whitespace characters from the start and end of the string.
The reason Environment.NewLine
may not work is because its value depends on whether you're running on Windows, Unix or Mac, but that really doesn't matter if you're getting the string from a remote system - the remote system will still return the same newline separator ('\n'
in this case).
Try...
value.Trim()
精彩评论