// substr.cs using System; public class SubStringSample { static void Main() { string str = "先頭の文字列真ん中の文字列末尾の文字列"; // 0 1 2 3 4 5 6 7 8 9 101112131415161718 string centerStr = str.Substring(6, 7); Console.WriteLine(centerStr); // 出力:真ん中の文字列 string rightStr = str.Substring(13); Console.WriteLine(rightStr); // 出力:末尾の文字列 } } // コンパイル方法:csc substr.cs