Click here to Skip to main content
15,939,960 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi all

below is my code

C#
string data = text;

           data = data.Trim();
           string[] arr;
           arr = data.Split(new[] { "CS" }, StringSplitOptions.None);
           lblw.Content = arr[10].Substring(0, 4);


In this the variable string[] arr; contains data like

"?\b??ML??0151\r00151\r00151\r00151\r00151\r00151\r00151\r00151\r00151\r00151\r00151\r00151\r00151\r00151\r00151\r00151\r00151\r00151\r00151\r00151"


In lblw.content i want 0151. the data is coming from serial port.

Please tell me how to do this.
Posted
Comments
BillWoodruff 24-Mar-14 2:08am    
For a question like this, I recommend you show a sample of the data before you call 'Split.

1 solution

Split the array on \r and then display the 3rd or 4th item (all of them seem to be same).
 
Share this answer
 
v2
Comments
[no name] 24-Mar-14 3:16am    
Got that..Thanks..

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