Guest User

Untitled

a guest
Nov 28th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.87 KB | None | 0 0
  1.  textBox1.Text = "";
  2.             textBox2.Text = "";
  3.             StreamReader sr = new StreamReader("text.txt");
  4.             string s="";
  5.             while (!sr.EndOfStream)
  6.             {
  7.                 s = sr.ReadLine();
  8.                 textBox1.Text = textBox1.Text + s + System.Environment.NewLine;
  9.                 int n = s.Length;
  10.                 for (int i = 0; i < n; i++)
  11.                 {
  12.                     if(n>2) break;
  13.                     if(n==2)
  14.                     {
  15.                         if (Char.IsDigit(s[0]) && Char.IsDigit(s[1]))
  16.                         {
  17.                             textBox2.Text = textBox2.Text + s + System.Environment.NewLine;
  18.                             break;
  19.                         }
  20.                         else break;
  21.                     }
  22.                     if (Char.IsDigit(s[i]))
  23.                     {
  24.                         if ((i == 0) && Char.IsDigit(s[i+1]) && !Char.IsDigit(s[i+2]))
  25.                         {
  26.                             textBox2.Text = textBox2.Text + s + System.Environment.NewLine;
  27.                             break;
  28.                         }
  29.                         if (i == n - 2)
  30.                         {
  31.                             if (Char.IsDigit(s[i+1]) && !Char.IsDigit(s[i-1]))
  32.                             {
  33.                                 textBox2.Text = textBox2.Text + s + System.Environment.NewLine;
  34.                                 break;
  35.                             }
  36.                         }
  37.                         else if ((i != n-1) && (i != 0) && Char.IsDigit(s[i+1]) && !Char.IsDigit(s[i+2]) && !Char.IsDigit(s[i-1]))
  38.                         {
  39.                             textBox2.Text = textBox2.Text + s + System.Environment.NewLine;
  40.                             break;
  41.                         }
  42.                     }
  43.                 }
  44.             }
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment