Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string s = textBox1.Text;
- bool check = true;
- for (int i = 0; i < s.Length; i++)
- {
- if (!((s[i] >= 'А' && s[i] <= 'Я') || s[i] == ' ' || s[i] == ',' || (s[i] >= 'а' && s[i] <= 'я')))
- check = false;
- }
- string[] names =s.Split (new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
- if (!(names.Length == 3))
- check = false;
- for (int i = 0; i < 3; i++)
- {
- string str = names[0].ToString();
- str += names[1].ToString().Substring(0, 1);
- //str += names[2].ToString().Substring(0, 1);
- listBox1.Items.Add(str);
- }
- if (!check)
- {
- MessageBox.Show("Накосячили");
- textBox1.Clear();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement