xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/substr.awk (revision e6d6c189fa3a95d7aa27bbe0aeacf7c1a6b57c8c)
1*e6d6c189SCody Peter MelloBEGIN {
2*e6d6c189SCody Peter Mello	x = "A"
3*e6d6c189SCody Peter Mello	printf("%-39s\n", substr(x,1,39))
4*e6d6c189SCody Peter Mello	print substr("abcdef", 0, 2)
5*e6d6c189SCody Peter Mello	print substr("abcdef", 2.3, 2)
6*e6d6c189SCody Peter Mello	print substr("abcdef", -1, 2)
7*e6d6c189SCody Peter Mello	print substr("abcdef", 1, 0)
8*e6d6c189SCody Peter Mello	print substr("abcdef", 1, -3)
9*e6d6c189SCody Peter Mello	print substr("abcdef", 1, 2.3)
10*e6d6c189SCody Peter Mello	print substr("", 1, 2)
11*e6d6c189SCody Peter Mello	print substr("abcdef", 5, 5)
12*e6d6c189SCody Peter Mello	print substr("abcdef", 7, 2)
13*e6d6c189SCody Peter Mello	exit (0)
14*e6d6c189SCody Peter Mello}
15