Is there anything I can replace AbsolutePath.Contains?

I have a Uri that contains a portion of the path that I put in an if block. Its something like

if (absUri.AbsolutePath.Contains("W3C//DTD%20XHTML%201.1//EN"))

      

I want to replace. Contains a piece of something more reliable and reliable, as if some line after // EN even satisfied the if block. The whole path looks something like this: C: /Users/a/desktop/fol/W3C//DTD%20XHTML%201.1//EN. Is there any method?

0


a source to share


2 answers


I was looking for something like .EndsWith I think.



+1


a source


Well, it doesn't matter if there is something after "// EN", as the string will still contain your search term.

You mentioned that you want something more robust and reliable, and what problem do you see?



As you .EndsWith

can imagine, it will fail if anything appears after "// EN", or if it changes, but I don't think it's more reliable than .Contains

. In fact, I would expect them to be as reliable as others.

0


a source







All Articles