Hi,
i need a function who compares a string and returns the results "greater than" or "lower than". It´s basically the same function like IntCmpU but only with strings. Are such a function available?
Best Regards
Rainer Budde
String Compare with more results
10 posts
Maybe, but you can try this: 🙂
SetCompressor lzma
XPStyle on
Name "Lobo Lunar"
OutFile "Hi.exe"
BrandingText "Lobo Lunar"
InstallDir "$EXEDIR"
ShowInstDetails show
Page instfiles "" "inst_show" ""
Function "inst_show"
StrCpy $1 "Holann" #input 1st. string
StrCpy $2 "Hello" #input 2nd. string
StrLen $0 $1 # 1st. string len.
StrLen $R0 $2 # 2nd. string len.
IntCmp $0 $R0 Equal Less More #Compare 1st with 2nd string, if 1st string is...
Equal: # If the 1st and the 2nd are the same:
DetailPrint "$1 and $2 are the same ($0)"
goto Exit
Less: # If 1st string is less...
DetailPrint "$1($0) is less than $2($R0)"
goto Exit
More: #If 1st is bigger....
DetailPrint "$1($0) is bigger than $2($R0)"
goto Exit
Exit: # The end
FunctionEnd
Section "-default"
; Nothing...
SectionEnd
Hi,
thanks for your answer. But I your function checks the length of the two strings. I need a function who compares to strings. For example:
1. String: "abc"
2. String: "ABC"
Best regards
Rainer
thanks for your answer. But I your function checks the length of the two strings. I need a function who compares to strings. For example:
1. String: "abc"
2. String: "ABC"
Best regards
Rainer
Do you ment uppercase vs. lowercase?
Originally posted by Lobo LunarNo, I don´t! For example: I have two strings:
Do you ment uppercase vs. lowercase?
1. String "1.11"
2. String "1.12"
Now I want compare both strings which is greater than the other. In Delphi I do this for example:
If AString1 >= AString2 then
ShowMessage('1st String is greater or equal')
else
ShowMessage('1st Strings is lower')
Maybe I can convert the two strings in double values and compare this. But I dont know how to do this?
Best Regards
Rainer
I believe StrCmp, is what you are after.
StrCmp "str1" "str2" jump_if_equal [jump_if_not_equal]
ie:
StrCmp "1" "2" lblEqual lblNotEqual
lblEqual:
MessageBox mb_ok "Equal"
goto lblDone
lblNotEqual:
MessageBox mb_ok "Not Equal"
lblDone:
Not exactly safe....but it is close to what you asked for...
The best way to do this is to use the version checking string function in the archive.
StrCmp "str1" "str2" jump_if_equal [jump_if_not_equal]
ie:
StrCmp "1" "2" lblEqual lblNotEqual
lblEqual:
MessageBox mb_ok "Equal"
goto lblDone
lblNotEqual:
MessageBox mb_ok "Not Equal"
lblDone:
Not exactly safe....but it is close to what you asked for...
The best way to do this is to use the version checking string function in the archive.
Hi,
Best regards
Rainer
Originally posted by zimsmsThat doesn´t help me!
I believe StrCmp, is what you are after.
StrCmp "str1" "str2" jump_if_equal [jump_if_not_equal]
ie:
StrCmp "1" "2" lblEqual lblNotEqual
lblEqual:
MessageBox mb_ok "Equal"
goto lblDone
lblNotEqual:
MessageBox mb_ok "Not Equal"
lblDone:
Not exactly safe....but it is close to what you asked for...
But I think this function helps me. I´ve searched for this function but I can´t find it. Where can I find this function?
The best way to do this is to use the version checking string function in the archive.
Best regards
Rainer
Originally posted by Speed78I don't know Delphi, but you can't compare like that strings, I think you are comparing the numbers not the strings.
[B]No, I don´t! For example: I have two strings:
1. String "1.11"
2. String "1.12"
If AString1 >= AString2 then
ShowMessage('1st String is greater or equal')
else
ShowMessage('1st Strings is lower')
According to the above example, there's one web archive.
Dotted Comparison Script
Call lstrcmp with System.dll.
Hi,
thx for your answer.
Best regards
Rainer
thx for your answer.
Originally posted by Lobo LunarThis is what I need.
I don't know Delphi, but you can't compare like that strings, I think you are comparing the numbers not the strings.
According to the above example, there's one web archive.
Dotted Comparison Script
Best regards
Rainer