From Sourav, 10 Years ago, written in Plain Text.
Embed
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6.  
  7. namespace Parse
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             char ch;
  14.             string temp="";
  15.             string account="";
  16.             string amount="";
  17.             string location="";
  18.             string date = "";
  19.             StreamReader reader;
  20.             reader = new StreamReader(@"C:\Users\slahoti2\New folder\LinkList\LinkList\sms.txt");
  21.             do
  22.             {
  23.                 ch = (char)reader.Read();
  24.                 if (ch != ' ')
  25.                     temp += ch;
  26.                 else
  27.                 {              
  28.                     if (temp == "a/c")
  29.                     {
  30.                         ch = (char)reader.Read();
  31.                         while ( (char)ch!= ' ')
  32.                         {
  33.                             account += ch;
  34.                             ch = (char)reader.Read();
  35.                            
  36.                         }
  37.  
  38.                     }
  39.                      if (temp == "INR")
  40.                     {
  41.                         ch = (char)reader.Read();
  42.                         while ( (char)ch!= ' ')
  43.                         {
  44.                             amount += ch;
  45.                             ch = (char)reader.Read();
  46.                            
  47.                         }
  48.  
  49.                     }
  50.  
  51.                           if (temp == "Info")
  52.                     {
  53.                         ch = (char)reader.Read();
  54.                         while ( (char)ch!= '.' && !reader.EndOfStream)
  55.                         {
  56.                             location += ch;
  57.                             ch = (char)reader.Read();
  58.                            
  59.                         }
  60.  
  61.                     }
  62.  
  63.                           if (temp == "on")
  64.                           {
  65.                               ch = (char)reader.Read();
  66.                               while ((char)ch != ' ')
  67.                               {
  68.                                   date += ch;
  69.                                   ch = (char)reader.Read();
  70.  
  71.                               }
  72.  
  73.                           }
  74.                     temp = "";
  75.  
  76.                 }
  77.                              
  78.                
  79.             } while (!reader.EndOfStream);
  80.             reader.Close();
  81.             reader.Dispose();
  82.             Console.WriteLine("Account no : "+account+"Amount :"+amount+"Location :"+ location+"On :"+date);
  83.             Console.ReadLine();
  84.         }
  85.     }
  86. }
  87.  

Replies to Parse rss

Title Name Language When
Re: Parse Sourav text 10 Years ago.