Er, no. If you do it that way, you allow the player to run arbitrary scripts, which even if they are not maliciously doing it might well cause accidental damage (Not too critical in SP, but a definite no-no in MP).
You could just use the command
parseNumber though, since well, that does exactly what you need! Be wary that anything that doesn't parse to a number, such as "Frogtree" will give you 0 and strings that contain numbers and non-numbers will give those numbers ("7 - fish" gives 7). Shouldn't be a problem though.