Jay Stewart

Jay Stewart

  • NA
  • 6
  • 629

Parsing a string not fixed length without delimeter

Oct 8 2018 11:00 AM

Given the following string

  1. 38051211)JLRx(0x04>0x01):JL_PAGE_INFO(0x63,0x00,0x01,0x03,0x00,0x73,0x00,0x00,0x0A,0x01,0x01,0xF2,0x01)  
How can I split it so I can use each split in a listview column?

I can use split at the : for example but then I need to split at the next ( and each value after split using the ,.

Any advice would be greatly appreciated, its how I add the 2nd and 3rd and so on parts I am struggling with
  1. {  
  2.    if (line.Contains("JLTx"))  
  3.    {  
  4.        string[] JLTx = line.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);  
  5.        listView1.Items.Add(JLTx[0]);  
  6.        listView1.Items[listView1.Items.Count - 1].SubItems.Add(JLTx[1]);                         
  7.    }

Answers (1)