T
tshad
IndexOf gives you the start of the string found in another string. How do
you get the end of the string found?
I am trying to get the path of the startup:
string stemp = Application.StartupPath;
I then want to do something like:
stemp =
stemp.Substring(0,stemp.IndexOf(@"theFolder\")+String.length((@"theFolder\"))
+ "afile.txt";
So that I would end up with something like:
c:\folder1\theFolder\afile.txt
I could do this by putting "theFolder" in a string and then taking the lengh
of the string in my Substring call,
var s = @"theFolder\";
stemp = stemp.Substring(0,stemp.IndexOf(s)+s.Length)) + "afile.txt";
but wanted to see if there was an easier way?
Thanks,
Tom
you get the end of the string found?
I am trying to get the path of the startup:
string stemp = Application.StartupPath;
I then want to do something like:
stemp =
stemp.Substring(0,stemp.IndexOf(@"theFolder\")+String.length((@"theFolder\"))
+ "afile.txt";
So that I would end up with something like:
c:\folder1\theFolder\afile.txt
I could do this by putting "theFolder" in a string and then taking the lengh
of the string in my Substring call,
var s = @"theFolder\";
stemp = stemp.Substring(0,stemp.IndexOf(s)+s.Length)) + "afile.txt";
but wanted to see if there was an easier way?
Thanks,
Tom