您的位置:首页 > 其它

.padLeft() and .padRight()

2013-01-24 21:29 183 查看
using System;

using System.Collections.Generic;

using System.Text;

namespace 添加空格

{

    class Program

    {

        static void Main(string[] args)

        {

            Console.WriteLine("请输入一段文字");

            string say = Console.ReadLine();

            Console.WriteLine(say.PadLeft(20)); //表示如果一个字符串的长度小于指定的值,则在字符串的左侧(也就是前面)用指定的字符填充

            Console.ReadKey();

        }

    }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: