C#小白学习笔记(3)占位符&转义符

namespace Demo03
{
    class Program
    {
        static void Main(string[] args)
        {
            /*
            string str = string.Format("我叫小明,今年22岁,来自上海。");
            Console.WriteLine(str);
            Console.ReadKey();
            */
            string str = string.Format("我叫{0},今年{1}岁,来自{2}。","小明",22,"西安");
            //大括号里的是占位符,占位符必须从0开始
            string str1 = "\"I am lucy\""; // \为转义字符
            string str2 = "\tabc";  // \t为tab缩进
            string str3 = @"\tabc";// @为取消转义符
            Console.WriteLine(str);
            Console.ReadKey();
        }
    }
}

 

posted @ 2020-09-16 11:29  ___lucky  阅读(208)  评论(0)    收藏  举报