using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
namespace Project_Scorps_1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Convert_Click(object sender, EventArgs e)
{
string s = textBox1.Text;
char [] c = new char [s.Length];
for (int i = 0; i < s.Length; i++)
{
if (i % 2 == 0)
{
(s[i].ToString()).ToUpper(CultureInfo.InvariantCulture);
}
if (i % 2 != 0)
{
(s[i].ToString()).ToLower();
}
}
textBox2.Text = s;
}
}
}
这是我迄今为止的代码。 textBox1是您输入传票的文本框,而textbox2是包含输出的框。C# - 将常规文本转换为TeXt的程序的程序
它给我输出的是我输入的同一个句子!
你只会在每次迭代时为's'指定一个字符。 – Femaref 2013-04-21 16:19:48