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 是包含输出的框。
它给我的输出与我输入的句子相同!