I have a string like this: 2899 8761 014 00:00:00 06/03/13 09:35 G918884770707
. I have to take the substring G918884770707
from this given string. I k
You've misunderstood the parameters to Substring - they aren't start and end (as they are in Java), they're start and length.
So you want:
No = line.Substring(Start, End - Start);
From the docs:
Parameters startIndex
Type:System.Int32
The zero-based starting character position of a substring in this instance.length
Type:System.Int32
The number of characters in the substring.Return Value
Type:System.String
A string that is equivalent to the substring of length length that begins at startIndex in this instance, or Empty if startIndex is equal to the length of this instance and length is zero.
Always, always read the documentation - particularly if you're getting an exception that you don't understand.