0

**How am I going to split a line of strings ang put it into an array if the strings are arranged into columns, just like the attached file
then compare the first column with user's input..? **

Edited by hyung101

Attachments
26   ,dgsgsgsgs   ,dsgsgsg     ,sdfsdfdsgs  ,m    ,dfgdfgsgsw     
20   ,dfgsgs      ,ggsgs       ,dsgdsfgsgs  ,f    ,fdgdsgsd       
27   ,dsgsgs      ,gssfg       ,dsgdgsf     ,m    ,dgsfgs         
35   ,dfgsgsfg    ,fgsgsg      ,dsgfsgs     ,m    ,sdgsgsg        
39   ,fdgsgs      ,fgsgs       ,sdggs       ,m    ,gsgdgdsgs      
45   ,fdgsgs      ,sgsgs       ,sgdbdfb     ,f    ,fgsgsg         
36   ,fgsgs       ,gsfgsgs     ,fgsgsg      ,f    ,fgsgs          
25   ,fdggs       ,fgsgsd      ,fgsgsg      ,f    ,fdgsdgs        
49   ,ggsgs       ,dfgsgsd     ,dfgsgs      ,f    ,f              
42   ,f           ,f           ,f           ,f    ,f              
21   ,gdgs        ,fgsgsd      ,sgsgs       ,m    ,dfgsdgfsd      
23   ,fggs        ,fgsgs       ,dfgdfgs     ,m    ,dfgdgds        
44   ,gsgsgs      ,fgsgfg      ,gsgsg       ,m    ,dfgsfgsdg      
46   ,gdfgsgs     ,dfgsgsg     ,sgsgsgsdg   ,f    ,fdgsgsgsd      
24   ,dfggsg      ,dfggdsg     ,dfgsgsgsd   ,f    ,dfgdgsg        
29   ,dfgsgsd     ,fgsgsdg     ,dfgsgsg     ,f    ,dfggsd
2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by hyung101
0

Use the String split method with a comma as the split character to separate the strings into a String array, then use trim() on each string to get rid of leading and/or trailing blanks as required.

Or, if you're a regex black-belt you could define the separator string as <any amount of white space><comma><any amount of white space> and do the whole job in one step.

Edited by JamesCherrill

0

.i used your first suggestion, and thank you so much for the reply, its a great help :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.