I was given a text document that has 5K+ names all in caps, and all in "double quotes." I have split all the names by the commas so I have a populated String[] filled with names in quotes. I need to remove all the quotes from the names, I have tried using .trim('"') but keep getting errors.
Here is my code:
public class NameScore {
public static void main(String[] args) throws IOException {
//File path to name list
String NAME_LIST = "/Users/BR/NameScores/src/p022_names.txt";
//imports the file with names
Scanner input = new Scanner(new File(NAME_LIST));
//Array list that holds the appx. 5K names. Each name split by a comma
String[] nameList = (input.nextLine()).split(",");
//puts the list into alphabetical order.
Arrays.sort(nameList);
for (int i = 0; i < nameList.length; i++) {
//nameList[i] = nameList[i].trim('"');
System.out.println(nameList[i]);
}
}
}