Skip to content

Commit fc09d1a

Browse files
author
runrevali
committed
[[ StdMlc ]] Update typeconvert docs
1 parent 2e87e6f commit fc09d1a

1 file changed

Lines changed: 26 additions & 11 deletions

File tree

libscript/src/type-convert.mlc

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
This module specifies the syntax for the complex type conversion operations available in modular LiveCode
2+
This library consists of the operations for performing complex type conversion in modular LiveCode
33
*/
44

55
module com.livecode.typeconvert
@@ -11,15 +11,22 @@ public foreign handler MCTypeConvertExecCombineListWithDelimiter(in Target as li
1111

1212
/*
1313
Summary: Splits the string in <Target> into a list of strings, using <Delimiter>
14-
as the delimiter. After execution, the container <Target> is a list.
14+
as the delimiter.
1515

1616
Target: An expression that evaluates to a string container.
1717
Delimiter: An expression that evaluates to a string.
1818

1919
Example:
20-
put "first,second,third,fourth,fifth" into tVar
21-
split tVar by ","
22-
put element 1 of tVar into tFirstElement // tFirstElement contains "first"
20+
variable tVar as string
21+
put "first,second,third,fourth,fifth" into tVar
22+
variable tSplit as list
23+
split tVar by "," into tSplit
24+
put element 1 of tSplit into tFirstElement // tFirstElement contains "first"
25+
26+
Description:
27+
Use the split command to convert a string representation of a list into a genuine (ordered) list.
28+
29+
Tags: Type conversion
2330
*/
2431

2532
syntax StringSplitBy is statement
@@ -30,16 +37,24 @@ end syntax
3037

3138
/*
3239
Summary: Combines the list of strings in <Target>, using <Delimiter>
33-
as the delimiter. After execution, the container <Target> is a string.
34-
40+
as the delimiter.
41+
3542
Target: An expression that evaluates to a list container.
3643
Delimiter: An expression that evaluates to a string.
3744

3845
Example:
39-
repeat with tDigit = 1 to 9
40-
put tDigit as string into element tDigit of tList
41-
end repeat
42-
combine tList with "," // tList contains "1,2,3,4,5,6,7,8,9"
46+
variable tDigits as list
47+
put [1,2,3,4,5,6,7,8,9] into tDigits
48+
49+
variable tString as string
50+
combine tDigits with "|" into tString // tString contains "1|2|3|4|5|6|7|8|9"
51+
52+
Description:
53+
Use the combine command to convert a list into a string representation of the list.
54+
55+
>*Note:* The list *must* consist entirely of string elements, otherwise the combine command will throw an error.
56+
57+
Tags: Type conversion
4358
*/
4459

4560
syntax CombineListWith is statement

0 commit comments

Comments
 (0)