How do i write expression as not equal in string
like ABC is not equal BCD in if condition
iam not using <> operator
both values are in string
How do i write expression as not equal in string
like ABC is not equal BCD in if condition
iam not using <> operator
both values are in string
These are 2 string variables do i need to convert to double for comparing the values
@T_Y_Raju No need to Convert it, you can compare in string by equal. In case it contains number then I would suggest you to use Conversion
@T_Y_Raju Try above Expression which I wrote
Hi @T_Y_Raju
You can compare it with the below expression
Strvar1 = "ABC"
Strvar2 = "DEF"
If - Not Strvar1.equals(Strvar2)
Hope it helps!!
If you want to compare greater than or less than, you have to CDbl both to compare the values. If you just want to see if they’re equal, it can work without converting, but I recommend against comparing them as strings. For example “01” and “1” are not equal as strings, but are equal as numbers. Same for “1.0” and “1” - different strings, same number value.
It’s a good rule of thumb to always convert numbers for comparison.
Also, a lot of people here like the .equals syntax:
NOT CDbl(strvar1).Equals(CDbl(strvar2))
However, this is the same as…
NOT CDbl(strvar1) = CDbl(strvar2)
…and I find the latter easier to read.
You can also use <>
…
CDbl(strvar1) <> CDbl(strvar2)