okay, im trying to read in this text file and only keep the lines with three tokens (lastname, firstname, and email). then i use these strings and make an object from them. then this object is placed in an ascending order arraylist... the problem is that one of the lines on the text file reads: "yo yo, ma , email@example.com ... the whitespace makes this come at the beginning of the arraylist.. is there anyway to scan this line of text in to where it gets rid of the whitespace and reads it in as: firstname = yo yo, lastname = ma, and email = firstname.lastname@example.org ??? Thanks! (Below is my code)
posted 10 years ago
I have two questions for you:
1. Do really need another method for scanning line or maybe there are some methods in java.lang.String class that can help you trim your whitespaces?
2. You have implemented compareTo method for Customer class but still the container you use cannot sort your Customer's and you have to do it by yourself. Sorting is frequent task and maybe you can find a container in core Java packages which can sort your list for you?
Think about it. [ September 02, 2005: Message edited by: George Bolyuba ]