You can use the Split function to separate all that line that is a variable of type String
in an array of sub-strings. Of course, it would be easier if you added to your total array (which in this case is Quality=87/94 Signal level=9dBm Noise level=103dBm
) a separation. For example, with commas; in other words, that it was in the following way:
Quality=87/94, Signal level=9dBm, Noise level=103dBm
This separates that string into substrings, and each substring stores it in an array. At the end you will put in the text box the position of the array that has the sub-string that has Signal level=9dBm
.
string charCommaString = "Quality=87/94, Signal level=9dBm, Noise level=103dBm";
char[] commaSeparator = new char[] { ',' };
string[] result;
result = charCommaString.Split(commaSeparator, StringSplitOptions.None);
Console.WriteLine(result[1]);
Look that my string charCommaString
contains the whole line that you want to extract only one part. I only added 3 commas.
In the fourth line of code what I do is use the Split()
method, which is responsible for separating the text of the variable String charCommaString
in sub-strings every time it finds a separator. In this case, the separator is a comma ",".
I hope my answer will help you.