I have two:
Variables:
request$input1 = “00”
request$input2 = “0000”
<@IF expr=”
‘A<@VAR input1>’ = ‘A<@VAR input2>’
“>
By placing an arbitrary letter before the variables, you will force TeraScript
to internally compare them as strings. This will be False.
OR
<@IF expr=”
<@CIPHER hash md5 <@VAR input1> = <@CIPHER hash md5 <@VAR
input2>>
“>
Since the MD5 hash of 0 is different from 00, this will be False. This trick
also allows you to do case sensitive string comparisons, where @IF normally is
case insensitive.
Robert
PS. Both of these short-comings are issues that should be corrected. I’ll add
them to my to-do list.
From: WebDude [mailto:[email protected]]
Sent: Monday, August 15, 2011 11:31 AM
To: [email protected]
Subject: RE: Witango-Talk: Exact Numeric Character IFs
Any ideas?
_____
From: WebDude [mailto:[email protected]]
Sent: Monday, August 15, 2011 9:39 AM
To: [email protected]
Subject: RE: Witango-Talk: Exact Numeric Character IFs
This is what I need...
0 = 0 True
00 = 0 False
Simply changing the TRUE and FALSE values does not work. Both of these equate
to TRUE.
All of these equate to true too...
<@IF EXPR="'000' = '0'" TRUE ="true" FALSE="false">
<@IF EXPR="'0' = '0'" TRUE ="true" FALSE="false">
<@IF EXPR="00000 = 0" TRUE ="true" FALSE="false">
<@IF EXPR="0 = 0" TRUE ="true" FALSE="false">
<@IFEQUAL "00" "0000">true<@ELSE>false</@IF>
<@IFEQUAL "0" "0">true<@ELSE>false</@IF>
_____
From: Bill Downall [mailto:[email protected]]
Sent: Monday, August 15, 2011 9:24 AM
To: [email protected]
Subject: Re: Witango-Talk: Exact Numeric Character IFs
John,
It seems to me like you should reverse your TRUE and FALSE values.
Bill
On Monday, August 15, 2011, WebDude <[email protected]> wrote:
> This has never come up before and I know it's probably a stupid question, but
> I am trying to write an IF statement where I need to compare characters
> rather then numbers. I went through the manual and I am a bit confused. I
> thought that if you used single quotes, it would look at the expression as a
> character compare rather then a numeric compare. For example...
>
> <@IF EXPR="'00000 = '0'" TRUE ="They really are not the same - one has a lot
> more zeros then the other" FALSE="They are the same">
>
> I have a client who has numeric codes that can start with multiple zeros and
> I need to be able to get a true or false depending on the actual characters
> rather then the numeric value.
>
> 00000 = 0 would then be false.
>
> Probably a stupid fix, I just cannot see it. By the way, the <@IFEQUAL> tag
> evaluates the same way. I need a string comparison rather the numeric.
>
> Any help would be appreciated.
>
> Thanks!
>
> John M.
>
>
>
>
>
> ________________________________
> To unsubscribe from this list, please send an email to [email protected]
> with "unsubscribe witango-talk" in the body.
_____
To unsubscribe from this list, please send an email to [email protected]
with "unsubscribe witango-talk" in the body.
_____
To unsubscribe from this list, please send an email to [email protected]
with "unsubscribe witango-talk" in the body.
_____
To unsubscribe from this list, please send an email to [email protected]
with "unsubscribe witango-talk" in the body.
----------------------------------------
To unsubscribe from this list, please send an email to [email protected]
with "unsubscribe witango-talk" in the body.