**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..? **
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
Edited by hyung101
- 2 Contributors
- forum2 Replies
- 16 Views
- 6 Years Discussion Span
- comment Latest Post by hyung101
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
.i used your first suggestion, and thank you so much for the reply, its a great help :)