Contact: aviboots(AT)netvision.net.il
39,879 questions
51,805 answers
573 users
using System; class Program { static void Main() { string url = "http://www.website.com/abc/xyz"; int pos = url.LastIndexOf("/") + 1; string s = url.Substring(pos, url.Length - pos); Console.WriteLine(s); } } /* run: xyz */
using System; using System.Linq; class Program { static void Main() { string url = "http://www.website.com/abc/xyz"; string s = url.Split('/').Last(); Console.WriteLine(s); } } /* run: xyz */
using System; class Program { static void Main() { string url = "http://www.website.com/abc/xyz"; string s = url.Substring(url.LastIndexOf("/") + 1); Console.WriteLine(s); } } /* run: xyz */