xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/strnum2.awk (revision 63f91fbc3c024870d86dc3332a4a0080fb29bc40)
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