# Problems with equals

**URL:** <https://discourse.processing.org/t/problems-with-equals/8102>\
**Category:** Processing for Android\
**Created:** [February 4, 2019, 3:54pm UTC](https://discourse.processing.org/t/problems-with-equals/8102 "2019-02-04T15:54:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Woodey](https://avatars.discourse-cdn.com/v4/letter/w/e19b73/32.png) [@Woodey](https://discourse.processing.org/u/Woodey)\
**Post date:** [February 4, 2019, 3:54pm UTC](https://discourse.processing.org/t/problems-with-equals/8102/1 "2019-02-04T15:54:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 5, 2019, 10:33am UTC](https://discourse.processing.org/t/problems-with-equals/8102/2 "2019-02-05T10:33:29Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Woodey](https://avatars.discourse-cdn.com/v4/letter/w/e19b73/32.png) [@Woodey](https://discourse.processing.org/u/Woodey)\
**Post date:** [February 6, 2019, 12:56am UTC](https://discourse.processing.org/t/problems-with-equals/8102/3 "2019-02-06T00:56:13Z")

</div>

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