Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: StrCmp StriCmp Compare strings numbers integers
test=StrCmp("20","3") Message("",test)Shouldn't this return a 1 since string1 is greater than string2? But it always returns a -1. Why is this simple code returning thees results?
If you want to compare numbers I recommend using the relational operators instead.
num1 = 20 num2 = 3 If num1 == num2 Pause("","Num1 is Equal to Num2") EndIf If num1 < num2 Pause("","Num1 is Less Than Num2") EndIf If num1 > num2 Pause("","Num1 is Greater Than Num2") EndIf
Article ID: W18289
Filename: StrCmp Problem.txt
File Created: 2008:12:22:09:46:50
Last Updated: 2008:12:22:09:46:50