cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
592
Views
0
Helpful
2
Replies

How to compare two string variables with IF command?

cjrchoi11
Level 1
Level 1

two variables,

-db_get_account,string,""

-db_account,string,""

1. get the digits into 'db_get_account' from 'Get Digit Sting' command

2. get the string into 'db_account' from 'DB Get' command

3. now I want to compare the two variables with 'IF' command to processing the next step when matches. I have no luck with 'IF(db_get_account == db_account)'

How to compare the two strings with IF command?

Thanks in advance,

2 Replies 2

geoff
Level 10
Level 10

You will be inside the Expression Editor working in Java. You want to see if two strings are equal, hence you must use the method on the Java String class. The Expression Editor will help you do this. I typically do a case insensitive match with the following method on the String class:

public boolean equalsIgnoreCase(String anotherString)

if (s1.equalsIgnoreCase(s2)) ...

Regards,

Geoff

Hi Geoff,

I still no luck with the IF command.

if(db_get_account.equalsIgnoreCase(db_account))

**caller input '12345' and store into 'db_get_account', and 'db_account' get string '12345' from database successfully but not hit the TRUE logic.

do I need something to do with boolean?

Thanks, John