I have been searching for over an hour and I can not for the life of me figure out how to search a string variable starting on the right. What I want to do is to get the last folder of a path (right before the file name), In VB6 I would do something like this:
Dim s As String
s = "C:WindowsSystem32FooBar"
Debug.Print Mid(s, InStrRev(Left(s, Len(s) - 1), "") + 1)
Here is what I tried so far:
string s = "C:\WindowsSystem32\Foo\Bar";
s = agencyName.Substring(s.LastIndexOf("") + 1)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…