Hi - I would like to separate out data as individual pieces.for eg, I have information as

1050 Buckingham Street,,Watertown,C,S06795660<br>737 McKNIGHT RD,,PITTSBURGH,P,S15237351<br>......(lot of data like this format)

And I am trying to get result as

addr1=1050 Buckingham Street
addr2 = null
city=Watertown
state=C
pincode=S06795660

currently I have code

int myIndex=myOutput.IndexOf(",");
  string addr1 = myOutput.Substring(0,myIndex);
  string addr2 = myOutput.Substring(myIndex,myOutput.Length-myIndex);

please help me.Also, Please let me know is there any easy way to fix this. Thanks!

Since your data is seperated by a delimiter (comma), you can do an array of data.
Then each index of an array will be holding each seperated data like address1, address2, city,..
This way will be faster and easier to sepetate.

So you can do:

string[] dataArray = myOutput.Split(',');
//so you now have all data in the array splitted:
string addr1 = dataArray[0];
string arr2 = dataArray[1];
string city = dataArray[2];
//and so on...
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.