Remove anchor from URL in C#
Posted
by kcoppock
on Stack Overflow
See other posts from Stack Overflow
or by kcoppock
Published on 2010-05-22T20:24:48Z
Indexed on
2010/05/22
20:30 UTC
Read the original article
Hit count: 198
I'm trying to pull in an src value from an XML document, and in one that I'm testing it with, the src is:
<content src="content/Orwell - 1984 - 0451524934_split_2.html#calibre_chapter_2"/>
That creates a problem when trying to open the file. I'm not sure what that #(stuff) suffix is called, so I had no luck searching for an answer. I'd just like a simple way to remove it if possible. I suppose I could write a function to search for a # and remove anything after, but that would break if the filename contained a # symbol (or can a file even have that symbol?)
Thanks!
© Stack Overflow or respective owner