And actually better than a LEN check, it might be safer to check that there is a ',' in the string since that is what you will be splitting on. So ignore my first suggestion and try this one instead.

 Code:
; test for multiple default gateways
if $lan AND $wlan
    ;shell command to remove route
    ;route delete 0.0.0.0 mask 0.0.0.0 192.168.2.254 if 15
    for each $item in $gateway
        if InStr($item,",")
            $data = split($item,",")
            $route_cmd = "route delete 0.0.0.0 mask 0.0.0.0 " + $data[0] + " if " + $data[1]
        endif
    Next
endif