The second argument to SubString is the number of characters in the substring.
A simplified way to do this.
int startIndex=25; // find out startIndex int endIndex=35; // find out endIndex, in this case it is text.Length; int length= endIndex - startIndex; // always subtract startIndex from the position wherever you want your substring to end ie endIndex // call substring Response.Write(text.Substring(startIndex,length));
you can perform some operation or call a function to get the start / end values โโof the index. With this approach, you are less likely to encounter any problems associated with indexes.
source share