/build/static/layout/Breadcrumb_cap_w.png

Scripting help

Below is my code, where I am getting confused...

This code is working fine : msgbox not displaying
-------------------------------------------------------
If "1" > "2" then
msgbox "wrong"
end if
-------------------------------------------------------
but
What is the problem in below code? if scenario is the same? : msgbox displaying
-------------------------------------------------------
If "99" > "100" then
msgbox "wrong"
end if
-------------------------------------------------------

0 Comments   [ + ] Show comments

Answers (2)

Posted by: itolutions 13 years ago
Purple Belt
0
"10"
string isn't the same as
10
number (integer type)

"1" > "2" - you are checking ONE STRING with ANOTHER.
Use
99 > 100
instead of
"99" > "100"
Posted by: pjgeutjens 13 years ago
Red Belt
0
when comparing 2 string values like this in vbs, you compare the values in the ASCII table for the starting characters,

so "99">"100" is the same as "9">"1" in ASCII terms, so thats TRUE, that's why your messagebox shows up.

Rgds,

PJ
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ