From Sourav, 10 Years ago, written in Plain Text.
This paste is a reply to Parse from Sourav - go back
Embed
Viewing differences between Parse and Re: Parse
/* Sms to be used 

Your a/c 594585 is debited INR 354.00 on 21-11-2014 17:45:31 Info PUR/HyperCity/Bangalore/

*/


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Parse
{
    class Program
    {
        static void Main(string[] args)
        {
            char ch;
            string temp="";
            string account="";
            string amount="";
            string location="";
            string date = "";
            StreamReader reader;
            reader = new StreamReader(@"C:\Users\slahoti2\New folder\LinkList\LinkList\sms.txt");
            do
            {
                ch = (char)reader.Read();
                if (ch != ' ')
                    temp += ch;
                else
                {              
                    if (temp == "a/c")
                    {
                        ch = (char)reader.Read();
                        while ( (char)ch!= ' ')
                        {
                            account += ch;
                            ch = (char)reader.Read();
                           
                        }

                    }
                     if (temp == "INR")
                    {
                        ch = (char)reader.Read();
                        while ( (char)ch!= ' ')
                        {
                            amount += ch;
                            ch = (char)reader.Read();
                           
                        }

                    }

                          if (temp == "Info")
                    {
                        ch = (char)reader.Read();
                        while ( (char)ch!= '.' && !reader.EndOfStream)
                        {
                            location += ch;
                            ch = (char)reader.Read();
                           
                        }

                    }

                          if (temp == "on")
                          {
                              ch = (char)reader.Read();
                              while ((char)ch != ' ')
                              {
                                  date += ch;
                                  ch = (char)reader.Read();

                              }

                          }
                    temp = "";

                }
                              
                
            } while (!reader.EndOfStream);
            reader.Close();
            reader.Dispose();
            Console.WriteLine("Account no : "+account+"Amount :"+amount+"Location :"+ location+"On :"+date);
            Console.ReadLine();
        }
    }
}