Quote from
luishp on April 17, 2019, 10:05 am
@asmat, you are comparing strings, not numbers.
Use this instead:
StrParse "[input]" "," [x]
ArrayLen [x] [len]
.finding maximum of array
setvar [max] [x(0)]
SetVar [length] [len]-1
.......................
Loop 1 [length] [i]
Math "[x([i])]" 0 [x([i])]
If [max] < [x([i])]
setvar [max] [x([i])]
Endif
endloop
setvar [max] [max]
The added Math command will convert any string to a number. This way you can even parse math calculations like this:
7,5,4+(2*3),44,55
Regards.
@asmat, you are comparing strings, not numbers.
Use this instead:
StrParse "[input]" "," [x]
ArrayLen [x] [len]
.finding maximum of array
setvar [max] [x(0)]
SetVar [length] [len]-1
.......................
Loop 1 [length] [i]
Math "[x([i])]" 0 [x([i])]
If [max] < [x([i])]
setvar [max] [x([i])]
Endif
endloop
setvar [max] [max]
The added Math command will convert any string to a number. This way you can even parse math calculations like this:
7,5,4+(2*3),44,55
Regards.
asmat has reacted to this post.