110,566
社区成员
发帖
与我相关
我的任务
分享
"\t\t\t"
WriteLine(string.Format("{0,-8}{1}", a[i], b[i]));
string[] a = { "上海", "北京", "广州", "呼和浩特" };
string[] b = { "1", "2", "3", "4" };
int max = 0;
foreach (string s in a)
{
int length = System.Text.Encoding.Unicode.GetByteCount(s);
if (length > max)
max = length;
}
using (StreamWriter sw = new StreamWriter("F:\\BBB.txt"))
{
for (int i = 0; i < a.Length; i++)
{
List<byte> list = new List<byte>(System.Text.Encoding.Unicode.GetBytes(a[i]));
for (int j = list.Count; j < max + 4; j++)
{
list.Add(32);
list.Add(0);
}
sw.WriteLine(System.Text.Encoding.Unicode.GetString(list.ToArray()) + b[i]);
}
sw.Close();
}