forked from DonovanChan/fmfunctions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommaDelimit.calc
31 lines (29 loc) · 823 Bytes
/
CommaDelimit.calc
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
Let ( [
~listEncoded = Substitute ( ¶ & theList & ¶ ; ¶ ; "¶|" ) ;
~listCulled =
Substitute ( ~listEncoded ;
[ "|¶" ; "" ] ;
[ "¶|" ; ¶ ]
) ;
~listNew = Middle ( ~listCulled ; 2 ; Length ( ~listCulled ) - 2 )
];
Substitute ( ~listNew ; "¶" ; ", " )
)
/* __________________________________________________
NAME: CommaDelimit ( theList )
PURPOSE: Replaces returns with commas
EXAMPLES:
List (
CommaDelimit ( "" ) = ""
; CommaDelimit ( "¶" ) = ""
; CommaDelimit ( "¶¶" ) = ""
; CommaDelimit ( "foo¶fum" ) = "foo, fum"
; CommaDelimit ( "foo¶fum¶" ) = "foo, fum"
; CommaDelimit ( "¶foo¶fum" ) = "foo, fum"
; CommaDelimit ( "foo¶¶fum" ) = "foo, fum"
; CommaDelimit ( "¶¶foo" ) = "foo"
; CommaDelimit ( "foo¶¶" ) = "foo"
)
HISTORY:
2014-08-18 15:13 PDT - Donovan Chandler
*/