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.

You can accomplish it quite easily with either regex (see Pattern and Matcher) or with a simple String.split(",") to separate the pair.
For the date part you can use SimpleDateFormat if you need to parse to a date value from the string.

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.

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)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.