My string is delete filename (filename )which i would give at run time this string is str3 I want only the filename(no matter what length it is). Here is my code:
int len = str3.Length;
string d = str3.Substring(6,len-1);// 6 for delete index and to get rest word is len -1
Console.Write(d);
But It is throwing me an exception.
Java? (2) what exactly is the input string? (3) what exactly is the exception.Substringmethod, it is not the index to stop at, it is the number of characters to copy. You can't copy that many characters (len-1) from the 6th position in the string.