6.2.5截取字符串

/*
截取字符串
    public string Substring(int startIndex, int Length);
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace std
{
    class taota
    {
        static void Main(string[] args)
        {
            Console.WriteLine("阅读下面这首诗:");
            string str = "花开百日研,\n一朝逢霜落。\n神已飘伶仃,\n更兼尘归堕。";   //获取诗句
            //截取字符串
            string str1 = str.Substring(0, 1) + str.Substring(11, 1) + str.Substring(14, 1) + str.Substring(25, 1);

            Console.WriteLine(str);
            Console.WriteLine("诗的大概意思是:{0}", str1);

            Console.ReadLine();
        }
    }


}

你可能感兴趣的:(6.2.5截取字符串)