PDA

View Full Version : Usage of the MAX$ MIN$ Keywords



Michael Clease
28-05-2007, 11:13
I dont get this keyword whats its purpose, whats it doing?



' Usage of the MAX$ Keyword example
' Usage of the MIN$ Keyword example
'
' Written by Abraxas


DIM MyNo1String as string value "What"
DIM MyNo2String as string value "is"
DIM MyNo3String as string value "the"
DIM MyNo4String as string value "Value"
DIM sMsg as string

sMsg += "String 1 " & MyNo1String & $CRLF
sMsg += "String 2 " & MyNo2String & $CRLF
sMsg += "String 3 " & MyNo3String & $CRLF
sMsg += "String 4 " & MyNo4String & $CRLF & $CRLF
smsg += "MAX$ " & MAX$(MyNo1String, MyNo2String, MyNo3String, MyNo4String) & $CRLF
smsg += "MIN$ " & MIN$(MyNo1String, MyNo2String, MyNo3String, MyNo4String) & $CRLF

MsgBox 0, sMsg

ErosOlmi
28-05-2007, 11:50
Taken. Thank
Added a note to help to remember MAX$ and MIN$ are case sensitive.

Michael Clease
28-05-2007, 12:14
but what do they do?

ErosOlmi
28-05-2007, 12:19
Return the maximum or minimum value from a list of strings.
Comparison for max or min is done using full ascii set so they are case sensitive.
To avoid this, just pass only capitalized (upper or lower) strings.

Michael Clease
28-05-2007, 12:34
I see it now perhaps this might be worth adding.



DIM MyNo1String as string value "What" ' ascii values 87 104 97 116
DIM MyNo2String as string value "is" ' ascii values 105 115
DIM MyNo3String as string value "the" ' ascii values 116 104 101
DIM MyNo4String as string value "Value" ' ascii values 86 97 108 117 101