I am creating a C # windows application to display current market rates in the market using the betfer exchange webfervice, I used
getmarketpricescompressed ()
which returns a price string that looks like this:
106093239~GBP~ACTIVE~0~1~~true~5.0~1343114432333~~N:7337~1~6992.56~2.16~~~false~~~~|2.16~1036.19~L~1~2.14~97.18~L~2~2.12~5.0~L~3~|2.18~467.36~B~1~2.2~34.12~B~2~2.22~162.03~B~3~:414464~2~102181.96~1.86~~~false~~~~|1.85~2900.33~L~1~1.84~1831.59~L~2~1.83~1593.73~L~3~|1.86~58.83~B~1~1.87~1171.77~B~2~1.88~169.15~B~3~
I don't know how to unzip this line correctly while I use this code:
GetMarketPricesCompressedReq price_req1 = new GetMarketPricesCompressedReq(); price_req1.header = header2; price_req1.marketId = marketid_temp; price_req1.currencyCode = "GBP"; GetMarketPricesCompressedResp price_resp = new GetMarketPricesCompressedResp(); price_resp = bfg2.getMarketPricesCompressed(price_req1); //MessageBox.Show(price_resp.errorCode.ToString()); //richTextBox1.Text = ""; //richTextBox1.Text = price_resp.marketPrices; string prices = price_resp.marketPrices; richTextBox1.Text = price_resp.marketPrices; string[] ab1 = prices.Split('|'); string[] temp = ab1[1].Split('~'); textBox3.Text = temp[0]; textBox4.Text = temp[4]; textBox5.Text = temp[8]; temp = ab1[2].Split('~'); textBox6.Text = temp[0]; textBox7.Text = temp[4]; textBox8.Text = temp[8]; temp = ab1[3].Split('~'); textBox9.Text = temp[0]; textBox10.Text = temp[4]; textBox11.Text = temp[8]; temp = ab1[4].Split('~'); textBox12.Text = temp[0]; textBox13.Text = temp[4]; textBox14.Text = temp[8]; if (ab1.Length >5) { temp = ab1[5].Split('~'); textBox15.Text = temp[0]; textBox16.Text = temp[4]; textBox17.Text = temp[8]; temp = ab1[6].Split('~'); textBox18.Text = temp[0]; textBox19.Text = temp[4]; textBox20.Text = temp[8]; }
It works fine for multiple matches, but I noticed line changes for several other matches and thus throws exceptions. Maybe any1 help me with the proper code to unzip this line, I looked for it and found a vb code that was not very useful ,
and btw, I want to arrange the data like this:
source share