c# - Split a string containing various spaces -


i have txt file follows , split them double arrays

node strain    axis  strain  f      p/s   sum    cur     moment 0   0.00000    0.00  0.0000     0     0     0     0      0.00 1   0.00041  -83.19  0.0002  2328   352     0     0     -0.80 2   0.00045  -56.91  0.0002  2329   352     0     0      1.45 3   0.00050  -42.09  0.0002  2327   353     0     0     -0.30 

my goal have series of arrays of each column. i.e. node[] = {0,1,2,3), axis[]= {0.00,-83.19,-56.91,-42.09}, ....

i know how read txt file , covert strings double arrays. problem values not separated tab, different number of spaces. googled find out way it. however, couldn't find any. discussed way constant spaces. if know how or there existing q&a issue , let me know, appreciated. thanks,

stringsplitoptions.removeemptyentires should trick:

var items = source.split(new [] { " " }, stringsplitoptions.removeemptyentries); 

the return value not include array elements contain empty string


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -