Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- textBox2.Text = textBox1.Text;
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- int spaces = 0, commas = 0;
- foreach (char ch in textBox1.Text)
- {
- if (ch == 32) spaces++;
- if (ch == 44) commas++;
- }
- if (spaces - commas == 3 && commas != 2)
- {
- string[] strMass = textBox1.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- string str = string.Join(" ", strMass) + ", ";
- textBox1.Text = str;
- textBox1.Select(textBox1.Text.Length, 0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement