简体   繁体   中英

Identification char in Label

I'm using Microsoft Visual Studio 2010. WPF App. I have to send 3 parameters in TCP Listener ( between java android client and c# server) To send one long string it work. so I sending like this : 32.234, 23,54321, 54.5432 As you can see there are 3 numbers. I want to save any number in variable. How can i do it ? I have all the string.

Split the string and convert to double:

string stringValue = "32.234, 23,54321, 54.5432";
double[] values = stringValue.Split(new [] {", "}, StringSplitOptions.None)
                        .Select(s => Convert.ToDouble(s)).ToArray();

Assuming all values are separated by ", " and value will always be convertible to double value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM