1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| function IsDecimal(byval str)
str = replace(str, ",",".")
if isnumeric(str) then
str = abs(str)
FOR i = 1 to len(str)
if not isnumeric(mid(str, i, 1)) then EXIT FOR
NEXT
response.Write("La partie entière de " & str & " est : " & mid(str, 1, i - 1) & "<br>")
response.Write("Le resultat de " & str & " - " & mid(str, 1, i - 1) & " = " & str - mid(str, 1, i - 1) & "<br>")
IsDecimal = eval(abs(str - mid(str, 1, i - 1)) > 0)
else
IsDecimal = false
end if
End function
str = "-4000000,98765345"
if IsDecimal(str) then response.Write(str & " est bien un nombre décimal!!") else response.Write("Oups, on dirait que " & str & " n'est pas un nombre décimal.<br>") |
Partager