diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-07-04 05:41:05 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-07-04 05:41:05 +0300 |
commit | 414cd1eccff2d6d6415e1f65ac2e51e7c1b33890 (patch) | |
tree | ec23aa620134a1c949840c1c9e3294ba89a83a43 /test/strnum2.awk | |
parent | 093f27aa0d53494c257cf16a57b01ad43f70cdff (diff) | |
parent | ff4e0706c5ee5dffd69168ebd0ff5f53e474d048 (diff) | |
download | egawk-414cd1eccff2d6d6415e1f65ac2e51e7c1b33890.tar.gz egawk-414cd1eccff2d6d6415e1f65ac2e51e7c1b33890.tar.bz2 egawk-414cd1eccff2d6d6415e1f65ac2e51e7c1b33890.zip |
Merge branch 'master' into feature/cmake
Diffstat (limited to 'test/strnum2.awk')
-rw-r--r-- | test/strnum2.awk | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/strnum2.awk b/test/strnum2.awk new file mode 100644 index 00000000..44931d5f --- /dev/null +++ b/test/strnum2.awk @@ -0,0 +1,18 @@ +BEGIN { + split(" 1.234 ", f, "|") # create a numeric string (strnum) value + OFMT = "%.1f" + 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 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 +} |