Skip to content

Commit 7f97f18

Browse files
author
runrevali
committed
[[ StdMlc ]] Update string docs
1 parent 7582c30 commit 7f97f18

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

libscript/src/string.mlc

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ Summary: Prepends <Source> to <Target>.
4242
Source: An expression which evaluates to a string.
4343
Target: An expression which evaluates to a string container.
4444

45+
Example:
46+
variable tVar as string
47+
put "" into tVar
48+
put "abc" before tVar -- tVar contains "abc"
49+
put "lpha" before char 2 of tVar
50+
put "eti" before char -1 of tVar -- tVar contains "alphabetic"
51+
52+
Description:
53+
Use to insert a string without replacement. Can be used either with a chunk expression to insert at a specified location, or without to prepend to the target string.
54+
55+
Tags: Strings
4556
*/
4657

4758
syntax PutStringBefore is statement
@@ -56,6 +67,16 @@ Summary: Appends <Source> to <Target>.
5667
Source: An expression which evaluates to a string.
5768
Target: An expression which evaluates to a string container.
5869

70+
Example:
71+
variable tVar as string
72+
put "" into tVar
73+
put "rent" after tVar -- tVar contains "rent"
74+
put "placeme" after char 2 of tVar -- tVar contains "replacement"
75+
76+
Description:
77+
Use to insert a string without replacement. Can be used either with a chunk expression to insert at a specified location, or without to append to the target string.
78+
79+
Tags: Strings
5980
*/
6081

6182
syntax PutStringAfter is statement
@@ -80,6 +101,8 @@ Example:
80101

81102
Description:
82103
Replaces each occurrence of the string <Pattern> in <Target> with <Replacement>.
104+
105+
Tags: Strings
83106
*/
84107

85108
syntax ReplaceString is statement
@@ -104,6 +127,7 @@ Example:
104127
Description:
105128
The result consists of the chars of <Left> followed by those of <Right>.
106129

130+
Tags: Strings
107131
*/
108132

109133
syntax ConcatenateStrings is left binary operator with precedence 2
@@ -125,6 +149,8 @@ Example:
125149

126150
Description:
127151
The result consists of the chars of <Left> followed by a space, and then the chars of <Right>.
152+
153+
Tags: Strings
128154
*/
129155

130156
syntax ConcatenateStringsWithSpace is left binary operator with precedence 2
@@ -142,6 +168,8 @@ output: <Source> with each of its chars uppercased.
142168

143169
Description:
144170
Lowercase letters, including special characters with diacritical marks, are converted to the uppercase equivalents. All other characters, including uppercase letters, numbers, punctuation, and special characters with no upper or lower case, are left unchanged.
171+
172+
Tags: Strings
145173
*/
146174

147175

@@ -157,7 +185,9 @@ Source: An expression which evaluates to a string.
157185
output: <Source> with each of its chars lowercased.
158186

159187
Description:
160-
Uppercase letters, including special characters with diacritical marks, are converted to the lowercase equivalents. All other characters, including lowercase letters, numbers, punctuation, and special characters with no upper or lower case, are left unchanged.
188+
Uppercase letters, including special characters with diacritical marks, are converted to the lowercase equivalents. All other characters, including lowercase letters, numbers, punctuation, and special characters with no upper or lower case, are left unchanged.
189+
190+
Tags: Strings
161191
*/
162192

163193

@@ -180,6 +210,7 @@ output: Returns true if <Left> is identical to <Right>.
180210
Description:
181211
The ```is``` operator is case sensitive.
182212

213+
Tags: Strings
183214
*/
184215

185216
syntax IsEqualTo is neutral binary operator with precedence 5
@@ -198,6 +229,8 @@ output: Returns true if <Left> is not identical to <Right>.
198229

199230
Description:
200231
The ```is not``` operator is case sensitive.
232+
233+
Tags: Strings
201234
*/
202235

203236
syntax IsNotEqualTo is neutral binary operator with precedence 5
@@ -216,6 +249,8 @@ output: Returns true if <Left> is less than <Right>
216249

217250
Description:
218251
<Left> is greater than <Right> if and only if <Left> and <Right> are not equal, and the unicode codepoint of the first char in <Left> that is not equal to the corresponding char in <Right> is of greater value.
252+
253+
Tags: Strings
219254
*/
220255

221256
syntax LessThan is neutral binary operator with precedence 3
@@ -233,6 +268,8 @@ output: Returns true if <Left> is greater than <Right>.
233268

234269
Description:
235270
<Left> is greater than <Right> if and only if <Left> and <Right> are not equal, and the unicode codepoint of the first char in <Left> that is not equal to the corresponding char in <Right> is of greater value.
271+
272+
Tags: Strings
236273
*/
237274

238275
syntax GreaterThan is neutral binary operator with precedence 3
@@ -256,6 +293,7 @@ Example:
256293
Description:
257294
Use ```the empty string``` to initialise a string variable. The empty string is synonymous with the string literal ""
258295

296+
Tags: Strings
259297
*/
260298

261299
syntax EmptyString is expression

0 commit comments

Comments
 (0)