Beispiel #1
0
  public boolean comparaDuasRespostas(String resp1, String resp2) throws java.lang.Exception {

    // --- prepara respostas para comparacao ---

    // From DataBase Notation
    String temp1 = StringConverter.fromDataBaseNotation(resp1);
    String temp2 = StringConverter.fromDataBaseNotation(resp2);

    // lowercase
    temp1 = temp1.toLowerCase();
    temp2 = temp2.toLowerCase();

    // sem acentos
    temp1 = StringConverter.removeAcentos(temp1);
    temp2 = StringConverter.removeAcentos(temp2);

    // corrige parenteses
    temp1 = StringConverter.replace(temp1, ") (", ")(");
    temp1 = StringConverter.replace(temp1, "( ", "(");
    temp1 = StringConverter.replace(temp1, " )", ")");
    temp2 = StringConverter.replace(temp2, ") (", ")(");
    temp2 = StringConverter.replace(temp2, "( ", "(");
    temp2 = StringConverter.replace(temp2, " )", ")");

    return temp1.equals(temp2);
  }