Reputation: 6029
I have an url:
http://www.domain.com/path/path/path/path/file1.html
And then another one:
http://www.domain.com/path/path/external/path/path/file1.html
Please notice /external/
within the path.
Now the files "are the same" but they target different audience based on the /external/
. If the path contains /external/ then it's for external use, otherwise is for internal use.
My question how do I relate these 2 files to each other? The '/external/' can be at any location within the path.
Each file might have max one external type or none at all.
Now to map the path to it's external type I am thinking to do like this:
For a specific file:
http://www.domain.com/path/path/path/path/file1.html
/external/
as a list
/external/
Upvotes: 0
Views: 534
Reputation: 3297
Well, actually you don't have to add all the file paths which contain /external/
into a list. You could simply use the String.Replace
method.
string targetPath = "http://www.domain.com/path/path/external/path/path/file1.html";
targetPath = targetPath.Replace("/external/", "/");
This will replace all /external/
parts in the string with a single /
. And if the string doesn't contain any /external/
string, it simply replaces nothing.
Upvotes: 3