Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi All
I have array value "RSSI=-68.2" where I need only 68.2
How can I get this in C# windows application


Thanks to All
Posted
Comments
Moumit Mondal 13-Sep-13 1:47am    
Please make ur question more explicit ...
Sergey Alexandrovich Kryukov 13-Sep-13 1:48am    
It's almost all clear; please see my answer.
—SA
Sergey Alexandrovich Kryukov 13-Sep-13 1:47am    
Read MSDN documentation before solving any programming problems. As this is about a string, reading on System.String would give you all you need. Please, don't be lazy. :-)
—SA

It does not matter if this is array element or anything else. The only important thing is this is a reference to a string object. Use string.Split:
http://msdn.microsoft.com/en-us/library/system.string.split.aspx[^].

I doubt you really need "68.2", more likely, you need "-68.2", so split by the delimiter '='.

—SA
 
Share this answer
 
Comments
Maciej Los 13-Sep-13 2:26am    
+5
Sergey Alexandrovich Kryukov 13-Sep-13 2:27am    
Thank you, Maciej.
—SA
You can also use Regular Expression to get the value you specified in an array string

Here is an example i can give you to get the value from a string.
C#
Regex r = new Regex(@"[0-9]+\.[0-9]+");
Match m = r.Match(myString);
string value = m.Value;
Console.WriteLine("{0} is a Number",value);


You can also get reference from the below link to learn further.
http://www.c-sharpcorner.com/uploadfile/puranindia/regular-expressions-in-C-Sharp/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900