• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/03_stdlib/09_join

  1 The `join()` function constructs a string out of the given array by
  2 converting each array item into a string and then joining these substrings
  3 putting the given separator value in between. An empty array will result in
  4 an empty string.
  5 
  6 The separator argument is converted into a string in case it is not already
  7 a string value.
  8 
  9 Returns `null` if the given array argument is not an array value.
 10 
 11 -- Testcase --
 12 {%
 13         printf("%.J\n", [
 14                 join("|", []),
 15                 join("|", [ 1, 2, 3 ]),
 16                 join("|", [ null, false, "" ]),
 17                 join(123, [ "a", "b", "c" ]),
 18                 join(123, { "not": "an", "array": "value" })
 19         ]);
 20 %}
 21 -- End --
 22 
 23 -- Expect stdout --
 24 [
 25         "",
 26         "1|2|3",
 27         "null|false|",
 28         "a123b123c",
 29         null
 30 ]
 31 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt