Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- textBox1.Text = "";
- textBox2.Text = "";
- StreamReader sr = new StreamReader("text.txt");
- string s="";
- while (!sr.EndOfStream)
- {
- s = sr.ReadLine();
- textBox1.Text = textBox1.Text + s + System.Environment.NewLine;
- int n = s.Length;
- for (int i = 0; i < n; i++)
- {
- if(n>2) break;
- if(n==2)
- {
- if (Char.IsDigit(s[0]) && Char.IsDigit(s[1]))
- {
- textBox2.Text = textBox2.Text + s + System.Environment.NewLine;
- break;
- }
- else break;
- }
- if (Char.IsDigit(s[i]))
- {
- if ((i == 0) && Char.IsDigit(s[i+1]) && !Char.IsDigit(s[i+2]))
- {
- textBox2.Text = textBox2.Text + s + System.Environment.NewLine;
- break;
- }
- if (i == n - 2)
- {
- if (Char.IsDigit(s[i+1]) && !Char.IsDigit(s[i-1]))
- {
- textBox2.Text = textBox2.Text + s + System.Environment.NewLine;
- break;
- }
- }
- else if ((i != n-1) && (i != 0) && Char.IsDigit(s[i+1]) && !Char.IsDigit(s[i+2]) && !Char.IsDigit(s[i-1]))
- {
- textBox2.Text = textBox2.Text + s + System.Environment.NewLine;
- break;
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment