Home > Software engineering >  Pattern based string parsing
Pattern based string parsing

Time:08-27

I have below string as input

string input = "{A.0a,100,0002_VL}{=}{A.0a,0400,0001_VL}{ }{A.0a,0410,0002_VL}{ }{A.0a,0420,0003_VL}"

I want below output as string array

string[] output 

output[0] = "A.0a,100,0002_VL"
output[1] = "="
output[2] = "A.0a,0400,0001_VL"
output[3] = " "
output[4] = "A.0a,0400,0002_VL"
output[5] = " "
output[6] = "A.0a,0410,0003_VL"

I want to use RegEx.Split function but unable to identity a pattern. Is it possible to use? Kindly help me.

Thank you!

Paresh

CodePudding user response:

char[] charArray = { '{', '}' };
    
var inputArray = input.Split( charArray, StringSplitOptions.RemoveEmptyEntries);
  • Related