aboutsummaryrefslogtreecommitdiffstats
path: root/test/strnum2.awk
diff options
context:
space:
mode:
Diffstat (limited to 'test/strnum2.awk')
-rw-r--r--test/strnum2.awk20
1 files changed, 14 insertions, 6 deletions
diff --git a/test/strnum2.awk b/test/strnum2.awk
index 16e6f5d0..44931d5f 100644
--- a/test/strnum2.awk
+++ b/test/strnum2.awk
@@ -1,10 +1,18 @@
BEGIN {
- split("1.234", f)
+ split(" 1.234 ", f, "|") # create a numeric string (strnum) value
OFMT = "%.1f"
- # check whether strnum is displayed the same way before and
+ CONVFMT = "%.2f"
+
+ # Check whether a strnum is displayed the same way before and
# after force_number is called. Also, should numeric strings
- # be formatted with OFMT or show the original string value?
- print f[1]
- x = f[1]+0 # trigger conversion to NUMBER
- print f[1]
+ # be formatted with OFMT and CONVFMT or show the original string value?
+
+ print f[1] # OFMT
+ print (f[1] "") # CONVFMT
+
+ # force conversion to NUMBER if it has not happened already
+ x = f[1]+0
+
+ print f[1] # OFMT
+ print (f[1] "") # CONVFMT
}