0

I have data in a list and each entry in the list is seperated as follows:

XXXXX,XX/XX/XXXX

Where the X represents a number. The data after the comma is supposed to be a date and could possibly be null. I need to take the first part of the data before the comma (XXXXX) and compare it to a value. If the value matches the XXXXX then I need to check if the data after the comma is not null for that entry in the list and continue from there. What is the best way to go about doing this? thanks.

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by javaAddict
0

Sorry I am a little confused. Each entry in the java list is in the format: XXXXX,XX/XX/XXXX

So if I use String.split(",") it would return an array of Strings as follows:

XXXXX,XX/XX/XXXX,XXXXX,XX/XX/XXXX... is this correct?

Would this work from a list? Wouldn't this make it difficult to compare XXXXX to the value and then if it matches go back to the array and find the corresponding date to see if it is null or not? thanks.

0

Sorry I am a little confused. Each entry in the java list is in the format: XXXXX,XX/XX/XXXX

So if I use String.split(",") it would return an array of Strings as follows:

XXXXX,XX/XX/XXXX,XXXXX,XX/XX/XXXX... is this correct?

If you use split for the XXXXX,XX/XX/XXXX:

String s="XXXXX,XX/XX/XXXX";
String [] tokens =s.split(",");

then tokens[0] will be: XXXXX
and tokens[1] will be: XX/XX/XXXX

Check the API in case it would be better for you to use the String.split( "," , -1 ) version. (I think this is used in case after the "," there are no other characters. I don't really remember very well)

This topic has been dead for over six months. 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.