The following code shows how to get the sub string.
using System; class MainClass{// w w w . j av a2s. com public static void Main(string[] args){ string left3 = "12345".Substring (0, 3); // left3 = "123"; string mid3 = "12345".Substring (1, 3); // mid3 = "234"; } }
If you omit the length, you get the remainder of the string:
using System; class MainClass/* www.j a v a 2 s. c o m*/ { public static void Main(string[] args) { string end3 = "".Substring (2); } }