Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
line.split
September 29, 2008 04:40PM
HI All,

It seems that the line.split() method works better for me than the stringTokenizer, can you for instance do the following

String delim1 = ":";
String delim2 = ",";

// bla bla code

String[] items = line.split(delim1,delim2) // splitting the input string with either one of the deliminators ?

The test code for above does not work nor does String[] items = line.split(:,) .

Is the example on page 127 the best way to use a "split" if there is more than one deliminator ?

Regards,
Re: line.split
October 03, 2008 12:31PM
Hi,

Looks like there's only two versions of the split method. Both only allow a 'regular expression' as delimiter. So no, you can't specify multiple delimiters. sad smiley

E
Sorry, only registered users may post in this forum.

Click here to login