xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/strnum2.awk (revision 78801af7286cd73dbc996d470f789e75993cf15d)
1BEGIN {
2	split(" 1.234 ", f, "|")	# create a numeric string (strnum) value
3	OFMT = "%.1f"
4	CONVFMT = "%.2f"
5
6	# Check whether a strnum is displayed the same way before and
7	# after force_number is called. Also, should numeric strings
8	# be formatted with OFMT and CONVFMT or show the original string value?
9
10	print f[1]	# OFMT
11	print (f[1] "")	# CONVFMT
12
13	# force conversion to NUMBER if it has not happened already
14	x = f[1]+0
15
16	print f[1]	# OFMT
17	print (f[1] "")	# CONVFMT
18}
19