Difference between revisions of "JoinText"

m (adding doc status category)
(Refined description, and added some 4.4.3 enhancements)
Line 4: Line 4:
 
[[Category:Text Functions]]
 
[[Category:Text Functions]]
  
Returns the elements of A (as text) concatenated along I and separated by separator.  If the optional finalSeparator parameter is provided, it is used as the final separator.  If any elements are numeric, they are converted to strings using the number format settings for the current node.
+
= JoinText( A, I'', separator, finalSeparator, default, textForNull'' ) =
  
= Declaration =
+
Returns the elements of «A» (as text) concatenated along «I».
  
  JoinText(A : coerce textual ArrayType all[I] ; I:IndexType;separator,finalSeparator : optional textual atomic)
+
If any elements are numeric, they are converted to strings using the number format settings for the current node.
 +
 
 +
[[Null]] items are ignored, unless «textForNull» is specified.
 +
 
 +
=== Optional parameters ===
 +
 
 +
{| border="0"
 +
! align="left" |
 +
* «separator»
 +
| : || text inserted between each item.
 +
|-
 +
! align="left" |
 +
* «finalSeparator»
 +
| : || Used instead of «separator» between the penultimate and final items.
 +
|-
 +
! align="left" |
 +
* «default»
 +
| : || ''(new in 4.4.3)'' The result value when there are no items to be joined. E.g., when all items are [[Null]].
 +
|-
 +
! align="left" |
 +
* «textForNull»
 +
| : || ''(new in 4.4.3)'' When specified, [[Null]] items are not ignored, and the text provided is used.
 +
|}
 +
 
 +
= Examples =
 +
 
 +
Suppose ''A'' is the following array, indexed by ''J'':
 +
::{| border="1"
 +
! J → || 1 || 2 || 3 || 4 || 5
 +
|-
 +
!
 +
| "one" || "two" || "three" || "four" || "five"
 +
|}
 +
 
 +
Then:
 +
<code>
 +
:{| border="0" align="left"
 +
| [[JoinText]](A,J) || &rarr; || "onetwothreefourfive"
 +
|-
 +
| [[JoinText]](A,J,',') || &rarr; || "one,two,three,four,five"
 +
|-
 +
| [[JoinText]](A,J,", "," and ") || &rarr; || "one, two, three, four and five"
 +
|}
 +
</code>
 +
 
 +
= See Also =
 +
 
 +
* [[SplitText]]
 +
* [[Text Concatenation Operator: &]]

Revision as of 16:52, 4 July 2012


JoinText( A, I, separator, finalSeparator, default, textForNull )

Returns the elements of «A» (as text) concatenated along «I».

If any elements are numeric, they are converted to strings using the number format settings for the current node.

Null items are ignored, unless «textForNull» is specified.

Optional parameters

  • «separator»
: text inserted between each item.
  • «finalSeparator»
: Used instead of «separator» between the penultimate and final items.
  • «default»
: (new in 4.4.3) The result value when there are no items to be joined. E.g., when all items are Null.
  • «textForNull»
: (new in 4.4.3) When specified, Null items are not ignored, and the text provided is used.

Examples

Suppose A is the following array, indexed by J:

J → 1 2 3 4 5
"one" "two" "three" "four" "five"

Then:

JoinText(A,J) "onetwothreefourfive"
JoinText(A,J,',') "one,two,three,four,five"
JoinText(A,J,", "," and ") "one, two, three, four and five"

See Also

Comments


You are not allowed to post comments.