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