当前位置:编程学习 > asp >>

string直接分成char数组

string直接分成char数组, 然后逐个输出来~
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            Console.WriteLine("字符 ---------- 十进制");
            for (int i = 0; i < s.Length; i++)
            {
                char c = s[i];
                Console.WriteLine("  {0}  ----------   {1} ",c,(int)c);
            }
        }
    }
}

 作者“McDelfino”

补充:Web开发 , ASP.Net ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,