Computer Science Canada

Splitting strings from a list

Author:  skada [ Wed Feb 11, 2009 1:49 am ]
Post subject:  Splitting strings from a list

I need a little help, very confused.

I have a List<String> and I need to get at the stuff inside the list so I can split it. I know how to split strings. I'm just not sure how to split the strings in a list. I tried splitting the List<String>, my program doesn't like that. I've tried moving it to a string using iterators but all the commas got lost.

Any help is very appreciated. Thank you.

Author:  DemonWasp [ Wed Feb 11, 2009 2:42 am ]
Post subject:  RE:Splitting strings from a list

I'm not sure I understand entirely. What are you trying to get out of the List <String> ? What do you need it for?

If you need to retrieve a given String from the list, you can just use listName.get(index) to retrieve the String at index from the list. Indicies start from zero.

Author:  S_Grimm [ Wed Feb 11, 2009 12:29 pm ]
Post subject:  RE:Splitting strings from a list

Some code MIGHT be helpful here, along with a detailed explination of EXACTLY what you need to hav happen and where it should be in the code

Author:  skada [ Wed Feb 11, 2009 6:07 pm ]
Post subject:  RE:Splitting strings from a list

The listNam.get() actually helps a lot. The book I'm looking at doesn't have that in it for some reason. Thank you, the was essentially a breakthrough. Thanks.

Author:  Vermette [ Thu Feb 12, 2009 11:25 am ]
Post subject:  Re: Splitting strings from a list

You can consult the javadoc on the List interface in order to see what's available to all the Collections using that interface:

http://java.sun.com/j2se/1.5.0/docs/api/java/util/List.html

Here's the docs on String, should have whatever else you're looking for:

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html


: