Problems with equals


#1

Hello, excuse my english

I have a problem with an If Equals query of two strings.
It is a processing code for Android.
The variable “Datum2” is the current date as a string without an intermediate character. The other variable is read from a sqlite database. The result is always false. Although the sample in the console looks identical.
Does anyone have an idea what the inaccuracy is?

The Code:
db.query( “SELECT * FROM VJ” );
for (int i = 0; i < db.getRecordCount(“VJ”); i = i+1) {
db.next ();
println ("."+Datum2+"-"+db.getString(“Datum”)+".");
if (Datum2.equals(db.getString(“Datum”))== true){
println("-----------------------------------------");
pass=db.getString(“Passw”);
break;

Thanks in advance.


#2

@Woodey===

i got the same problem with dates, one from a JSon, the other from an internal value: in console they were absolutely identical and yet equals was returning false ; now i cannot remember exactly what was the cause (UTF encoding???, presence of “/” in the date?) and what i have done to solve; it seems to me that i had to trim the charSeq before…And used lenght() in order to verify if chars number was exactly the same and perhaps also change the date Format.


#3

problem solved
Your suggestions, I had already tested. I had an error in my database.
Thanks for the answer