diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2021-06-23 20:30:13 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2021-06-23 20:30:13 +0300 |
commit | 98ef29fdcadffc0a05c91883c4ab8809a8b0d441 (patch) | |
tree | 9187c5f7e94f956ee29ff54c79d5ddf825cc7fc0 /doc/gawktexi.in | |
parent | 1bf8a67c114568b307c1df6dfe2042e2a3eab49b (diff) | |
download | egawk-98ef29fdcadffc0a05c91883c4ab8809a8b0d441.tar.gz egawk-98ef29fdcadffc0a05c91883c4ab8809a8b0d441.tar.bz2 egawk-98ef29fdcadffc0a05c91883c4ab8809a8b0d441.zip |
More doc updates.
Diffstat (limited to 'doc/gawktexi.in')
-rw-r--r-- | doc/gawktexi.in | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 81a24079..236ef638 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -22168,7 +22168,7 @@ function shell_quote(s, # parameter @end example @node Isnumeric Function -@subsection Checking whether a value is numeric +@subsection Checking Whether A Value Is Numeric A frequent programming question is how to ascertain whether a value is numeric. This can be solved by using this example function @code{isnumeric()}, which @@ -22183,16 +22183,21 @@ employs the trick of converting a string value to user input by using the 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 - @} + switch (typeof(x)) @{ + case "strnum": + case "number": + return 1 + case "string": + return (split(x, f, " ") == 1) && (typeof(f[1]) == "strnum") + default: + return 0 + @} @} + +Please note that leading or trailing white space is disregarded in deciding +whether a value is numeric or not, so if it matters to you, you may want +to add an additional check for that. + @c endfile @end example @@ -23037,8 +23042,8 @@ $ @kbd{awk -f getopt.awk -v _getopt_test=1 -- -a \} @print{} c = <otherd>, Optarg = <> @print{} c = <otherc>, Optarg = <> @print{} non-option arguments: -@print{} ARGV[8] = <arg1> -@print{} ARGV[9] = <arg2> +@print{} ARGV[8] = <arg1> +@print{} ARGV[9] = <arg2> @end example In all the runs, the first @option{--} terminates the arguments to @@ -25235,7 +25240,7 @@ look nice on the page: @end ignore @c file eg/prog/split.awk -function usage( common) +function usage( common) @{ common = "[-a suffix-len] [file [outname]]" printf("usage: split [-l count] %s\n", common) > "/dev/stderr" @@ -29068,7 +29073,7 @@ main(void) printf("%d\n", x + y); return 0; @} -$ @kbd{cc -O add.c -o add} @ii{Compile the program} +$ @kbd{cc -O add.c -o add} @ii{Compile the program} @end example You could then write an exceedingly simple @command{gawk} program |