summaryrefslogtreecommitdiff
path: root/awklib/eg/lib/isnumeric.awk
blob: 6309e76ab7d0be78afe6a4a72f9a0e7d52e9206c (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
	}
}