I have some Urls string, such as:
http://www.testproject.com/tokyo/4
http://www.testproject.com/india/11
http://www.testproject.com/singapore/819
How to get the number ("4". "11", "819") in the end of Url?
I have some Urls string, such as:
http://www.testproject.com/tokyo/4
http://www.testproject.com/india/11
http://www.testproject.com/singapore/819
How to get the number ("4". "11", "819") in the end of Url?
The other answers using string methods would be correct if this was a simple string, but since this is a URL, you should use the proper class to handle URIs:
var url = new Uri("http://www.testproject.com/tokyo/4");
var lastSegment = url.Segments.Last();