-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlist.implode.fmfn
More file actions
39 lines (29 loc) · 1.07 KB
/
list.implode.fmfn
File metadata and controls
39 lines (29 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
Purpose: Joins the values (list) with the provided glue (text).
Returns: Text
Name: list.implode ( glue; values )
Parameters: ( glue ) text
( values ) list = FileMaker List ( return delimited list )
Dependencies: NONE
References: Modeled after PHP's implode: http://us2.php.net/manual/en/function.implode.php
2016-05-01, JPS, No properly processes '\¶'
2012-08-06, JPS, Updated the empty case statement to use valueCount
2012-08-01, JPS, Now strips the last carriage return from the results, by using the result of GetValue (firstValue)
2011-09-20, JPS, Created.
*/
Let (
[
countValues = ValueCount ( values );
firstValue = GetValue ( values; 1 )
];
Case (
//If values is empty return and empty string
countValues = 0;
"";
//If there is only a single value return the value
countValues = 1;
firstValue;
//Return the values with the provided glue
Substitute ( firstValue & glue & list.implode ( glue; RightValues ( values; countValues - 1 )); "\¶"; "¶" )
)
)