Advertisement
Jack-TW

Taiwan Convenience Store Data Process WebClinet Version

Oct 21st, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Net;
  6. namespace ConsoleApplication1
  7. //This code just my friend's homework.
  8. //Question Description:
  9. //Process the data form web, filter the telephone number if begins with "06", show it telephone number,store name and address.
  10. //"06" is south of Taiwan local telephone phone code.
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.     //Hey, Data here.
  16.             string url="https://docs.google.com/uc?export=download&id=0B0eazGf8c9cJOV81Z2tqbml1aGM";
  17.             WebClient web=new WebClient();
  18.             string str = web.DownloadString(url);
  19.             string[] strAry = str.Split('\n');
  20.             for (int i = 0; i < strAry.Length; i++) {
  21.                 string[] line = strAry[i].Split(';');
  22.                 if (line[1].Substring(0,2)=="06"){
  23.                     Console.WriteLine(line[1] + "," + line[0] + "," + line[3]);
  24.                 }
  25.             }
  26.             Console.ReadLine();
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement