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