来源:http://mcdelfino.blog.51cto.com/2058744/660711
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);
- }
- }
- }
- }