I need to remove the underscore and all characters before it in my filename. The syntax of the filename is as follows:
<username>_<NameofFile>_<InstructorName>_<ClassName>.xls
I want to keep everything BUT the <username>_
part.
I tried using .Split
as follows:
string newfilename = file.Split('_')[1];
but that dropped everything and only kept <NameOfFile>
.
How could this be achieved?
string newfilename = file.Substring(file.IndexOf('_') + 1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With