summaryrefslogtreecommitdiffstats
path: root/contrib/awk/test/substr.awk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/awk/test/substr.awk')
-rw-r--r--contrib/awk/test/substr.awk14
1 files changed, 14 insertions, 0 deletions
diff --git a/contrib/awk/test/substr.awk b/contrib/awk/test/substr.awk
new file mode 100644
index 0000000..6016369
--- /dev/null
+++ b/contrib/awk/test/substr.awk
@@ -0,0 +1,14 @@
+BEGIN {
+ x = "A"
+ printf("%-39s\n", substr(x,1,39))
+ print substr("abcdef", 0, 2)
+ print substr("abcdef", 2.3, 2)
+ print substr("abcdef", -1, 2)
+ print substr("abcdef", 1, 0)
+ print substr("abcdef", 1, -3)
+ print substr("abcdef", 1, 2.3)
+ print substr("", 1, 2)
+ print substr("abcdef", 5, 5)
+ print substr("abcdef", 7, 2)
+ exit (0)
+}
OpenPOWER on IntegriCloud