aboutsummaryrefslogtreecommitdiffstats
path: root/awklib/eg/lib/isnumeric.awk
blob: 461ba91ab03fe056a6b30c1258f692ab39ea28a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# isnumeric --- check whether a value is numeric

function isnumeric(x,  f)
{
    switch (typeof(x)) {
    case "strnum":
    case "number":
        return 1
    case "string":
        return (split(x, f, " ") == 1) && (typeof(f[1]) == "strnum")
    default:
        return 0
    }
}