Paresh Dehadray
Paresh Dehadray

Reputation: 26

Pattern based string parsing

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,0410,0002_VL"
output[5] = "+"
output[6] = "A.0a,0420,0003_VL"

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

Upvotes: 0

Views: 56

Answers (1)

Qwerty
Qwerty

Reputation: 437

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

Upvotes: 2

Related Questions