Store part of a string in a variable

2

I get the string below, through a response.StreamReader :

240144|000|5511946724649|2015-08-30 21:45:51|2015-08-30 21:46:02|1|

How do I proceed to store the contents between the pipes each in a variable?

    
asked by anonymous 02.09.2015 / 04:44

1 answer

7

Use Split() :

var items = texto.Split('|');

This will generate an array , if you want to grab each element and place in each variable you want. This is even a manual job.

See an example working on dotNetFiddle .

    
02.09.2015 / 04:56