These two strings don't compare as I need them. What do I need to do?

Hi. I need to eliminate some words from a text. Here is my code:

StringList rawstring;
rawstring = new StringList();
String[] passerstring = loadStrings("NovumOrganum.txt");
String[] stopwords = loadStrings("stopwords.txt");
String[] romans = loadStrings("roman.txt" );
rawstring.append(passerstring);

String comp1 = rawstring.get(19 ); //Equals "I".
String comp2 = romans[0]; //Equals "I".

comp1.replaceAll("\n", "");  // I thought carriage returns may have been 
comp1.replaceAll("\r", "");  // the problem, but this didn't work.
comp2.replaceAll("\n", "");  
comp2.replaceAll("\r", "");

println(comp1.equals(comp2)); //Prints "false".
println(comp1); //Prints "I".
println(comp2); // Prints "I".

What do I need to do? Please help. :(

Answers

Sign In or Register to comment.