@grain/stdlib 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/array.md +491 -491
- package/bigint.md +198 -198
- package/buffer.gr +66 -1
- package/buffer.md +395 -272
- package/bytes.gr +1 -0
- package/bytes.md +200 -199
- package/char.md +125 -125
- package/exception.md +9 -9
- package/float32.md +195 -195
- package/float64.md +195 -195
- package/fs.md +115 -115
- package/hash.md +16 -16
- package/int16.md +155 -155
- package/int32.gr +1 -1
- package/int32.md +207 -207
- package/int64.gr +1 -1
- package/int64.md +207 -207
- package/int8.md +155 -155
- package/json.md +59 -59
- package/list.md +347 -347
- package/map.md +222 -222
- package/marshal.md +12 -12
- package/number.gr +119 -5
- package/number.md +503 -261
- package/option.md +141 -141
- package/package.json +2 -2
- package/path.gr +82 -65
- package/path.md +210 -141
- package/pervasives.md +238 -238
- package/priorityqueue.md +112 -112
- package/queue.md +117 -117
- package/random.md +37 -37
- package/range.md +36 -36
- package/rational.md +107 -107
- package/regex.md +91 -91
- package/result.md +102 -102
- package/runtime/atof/decimal.md +6 -6
- package/runtime/compare.md +7 -7
- package/runtime/dataStructures.md +178 -178
- package/runtime/equal.md +7 -7
- package/runtime/exception.md +15 -15
- package/runtime/malloc.md +9 -9
- package/runtime/numbers.md +269 -269
- package/runtime/string.md +17 -17
- package/runtime/unsafe/conv.md +6 -6
- package/runtime/unsafe/memory.gr +2 -19
- package/runtime/unsafe/memory.md +10 -10
- package/runtime/utf8.md +31 -31
- package/runtime/wasi.md +9 -9
- package/set.md +211 -211
- package/stack.md +122 -122
- package/string.md +228 -228
- package/uint16.md +148 -148
- package/uint32.md +192 -192
- package/uint64.md +192 -192
- package/uint8.md +148 -148
- package/uri.md +77 -77
- package/wasi/file.md +269 -269
- package/wasi/process.md +21 -21
- package/wasi/random.md +9 -9
- package/wasi/time.md +12 -12
package/string.md
CHANGED
|
@@ -58,16 +58,16 @@ Concatenate two strings.
|
|
|
58
58
|
|
|
59
59
|
Parameters:
|
|
60
60
|
|
|
61
|
-
|param|type|description|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
| param | type | description |
|
|
62
|
+
| ------ | -------- | -------------------- |
|
|
63
|
+
| `str1` | `String` | The beginning string |
|
|
64
|
+
| `str2` | `String` | The ending string |
|
|
65
65
|
|
|
66
66
|
Returns:
|
|
67
67
|
|
|
68
|
-
|type|description|
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
| type | description |
|
|
69
|
+
| -------- | ------------------- |
|
|
70
|
+
| `String` | The combined string |
|
|
71
71
|
|
|
72
72
|
Examples:
|
|
73
73
|
|
|
@@ -90,15 +90,15 @@ Returns the character length of the input string.
|
|
|
90
90
|
|
|
91
91
|
Parameters:
|
|
92
92
|
|
|
93
|
-
|param|type|description|
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
| param | type | description |
|
|
94
|
+
| -------- | -------- | --------------------- |
|
|
95
|
+
| `string` | `String` | The string to inspect |
|
|
96
96
|
|
|
97
97
|
Returns:
|
|
98
98
|
|
|
99
|
-
|type|description|
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
| type | description |
|
|
100
|
+
| -------- | -------------------------------------- |
|
|
101
|
+
| `Number` | The number of characters in the string |
|
|
102
102
|
|
|
103
103
|
Examples:
|
|
104
104
|
|
|
@@ -121,15 +121,15 @@ Returns the byte length of the input string.
|
|
|
121
121
|
|
|
122
122
|
Parameters:
|
|
123
123
|
|
|
124
|
-
|param|type|description|
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
| param | type | description |
|
|
125
|
+
| -------- | -------- | --------------------- |
|
|
126
|
+
| `string` | `String` | The string to inspect |
|
|
127
127
|
|
|
128
128
|
Returns:
|
|
129
129
|
|
|
130
|
-
|type|description|
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
| type | description |
|
|
131
|
+
| -------- | --------------------------------- |
|
|
132
|
+
| `Number` | The number of bytes in the string |
|
|
133
133
|
|
|
134
134
|
Examples:
|
|
135
135
|
|
|
@@ -152,15 +152,15 @@ Determines if the string contains no characters.
|
|
|
152
152
|
|
|
153
153
|
Parameters:
|
|
154
154
|
|
|
155
|
-
|param|type|description|
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
| param | type | description |
|
|
156
|
+
| -------- | -------- | --------------------- |
|
|
157
|
+
| `string` | `String` | The string to inspect |
|
|
158
158
|
|
|
159
159
|
Returns:
|
|
160
160
|
|
|
161
|
-
|type|description|
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
| type | description |
|
|
162
|
+
| ------ | --------------------------------------------------- |
|
|
163
|
+
| `Bool` | `true` if the string is empty and `false` otherwise |
|
|
164
164
|
|
|
165
165
|
### String.**indexOf**
|
|
166
166
|
|
|
@@ -177,16 +177,16 @@ Finds the first position of a substring in the input string.
|
|
|
177
177
|
|
|
178
178
|
Parameters:
|
|
179
179
|
|
|
180
|
-
|param|type|description|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
| param | type | description |
|
|
181
|
+
| -------- | -------- | --------------------- |
|
|
182
|
+
| `search` | `String` | The substring to find |
|
|
183
|
+
| `string` | `String` | The string to inspect |
|
|
184
184
|
|
|
185
185
|
Returns:
|
|
186
186
|
|
|
187
|
-
|type|description|
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
| type | description |
|
|
188
|
+
| ---------------- | ----------------------------------------------------------------------------------------------- |
|
|
189
|
+
| `Option<Number>` | `Some(position)` containing the starting position of the substring if found or `None` otherwise |
|
|
190
190
|
|
|
191
191
|
Examples:
|
|
192
192
|
|
|
@@ -209,16 +209,16 @@ Finds the last position of a substring in the input string.
|
|
|
209
209
|
|
|
210
210
|
Parameters:
|
|
211
211
|
|
|
212
|
-
|param|type|description|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
212
|
+
| param | type | description |
|
|
213
|
+
| -------- | -------- | --------------------- |
|
|
214
|
+
| `search` | `String` | The substring to find |
|
|
215
|
+
| `string` | `String` | The string to inspect |
|
|
216
216
|
|
|
217
217
|
Returns:
|
|
218
218
|
|
|
219
|
-
|type|description|
|
|
220
|
-
|
|
221
|
-
|
|
219
|
+
| type | description |
|
|
220
|
+
| ---------------- | ----------------------------------------------------------------------------------------------- |
|
|
221
|
+
| `Option<Number>` | `Some(position)` containing the starting position of the substring if found or `None` otherwise |
|
|
222
222
|
|
|
223
223
|
Examples:
|
|
224
224
|
|
|
@@ -241,16 +241,16 @@ Get the Unicode code point at the position in the input string.
|
|
|
241
241
|
|
|
242
242
|
Parameters:
|
|
243
243
|
|
|
244
|
-
|param|type|description|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
244
|
+
| param | type | description |
|
|
245
|
+
| ---------- | -------- | --------------------- |
|
|
246
|
+
| `position` | `Number` | The position to check |
|
|
247
|
+
| `string` | `String` | The string to search |
|
|
248
248
|
|
|
249
249
|
Returns:
|
|
250
250
|
|
|
251
|
-
|type|description|
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
| type | description |
|
|
252
|
+
| -------- | ------------------------------------------- |
|
|
253
|
+
| `Number` | The character code at the provided position |
|
|
254
254
|
|
|
255
255
|
Throws:
|
|
256
256
|
|
|
@@ -283,16 +283,16 @@ Get the character at the position in the input string.
|
|
|
283
283
|
|
|
284
284
|
Parameters:
|
|
285
285
|
|
|
286
|
-
|param|type|description|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
286
|
+
| param | type | description |
|
|
287
|
+
| ---------- | -------- | --------------------- |
|
|
288
|
+
| `position` | `Number` | The position to check |
|
|
289
|
+
| `string` | `String` | The string to search |
|
|
290
290
|
|
|
291
291
|
Returns:
|
|
292
292
|
|
|
293
|
-
|type|description|
|
|
294
|
-
|
|
295
|
-
|
|
293
|
+
| type | description |
|
|
294
|
+
| ------ | -------------------------------------- |
|
|
295
|
+
| `Char` | The character at the provided position |
|
|
296
296
|
|
|
297
297
|
Throws:
|
|
298
298
|
|
|
@@ -325,15 +325,15 @@ Split a string into its Unicode characters.
|
|
|
325
325
|
|
|
326
326
|
Parameters:
|
|
327
327
|
|
|
328
|
-
|param|type|description|
|
|
329
|
-
|
|
330
|
-
|
|
328
|
+
| param | type | description |
|
|
329
|
+
| -------- | -------- | ------------------- |
|
|
330
|
+
| `string` | `String` | The string to split |
|
|
331
331
|
|
|
332
332
|
Returns:
|
|
333
333
|
|
|
334
|
-
|type|description|
|
|
335
|
-
|
|
336
|
-
|
|
334
|
+
| type | description |
|
|
335
|
+
| ------------- | ------------------------------------------------ |
|
|
336
|
+
| `Array<Char>` | An array containing all characters in the string |
|
|
337
337
|
|
|
338
338
|
Throws:
|
|
339
339
|
|
|
@@ -362,15 +362,15 @@ Create a string from an array of characters.
|
|
|
362
362
|
|
|
363
363
|
Parameters:
|
|
364
364
|
|
|
365
|
-
|param|type|description|
|
|
366
|
-
|
|
367
|
-
|
|
365
|
+
| param | type | description |
|
|
366
|
+
| ----- | ------------- | -------------------- |
|
|
367
|
+
| `arr` | `Array<Char>` | The array to combine |
|
|
368
368
|
|
|
369
369
|
Returns:
|
|
370
370
|
|
|
371
|
-
|type|description|
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
| type | description |
|
|
372
|
+
| -------- | -------------------------------------------------- |
|
|
373
|
+
| `String` | A string representation of the array of characters |
|
|
374
374
|
|
|
375
375
|
Examples:
|
|
376
376
|
|
|
@@ -393,15 +393,15 @@ Create a string that is the given string reversed.
|
|
|
393
393
|
|
|
394
394
|
Parameters:
|
|
395
395
|
|
|
396
|
-
|param|type|description|
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
| param | type | description |
|
|
397
|
+
| -------- | -------- | --------------------- |
|
|
398
|
+
| `string` | `String` | The string to reverse |
|
|
399
399
|
|
|
400
400
|
Returns:
|
|
401
401
|
|
|
402
|
-
|type|description|
|
|
403
|
-
|
|
404
|
-
|
|
402
|
+
| type | description |
|
|
403
|
+
| -------- | ---------------------------------------------------------------------- |
|
|
404
|
+
| `String` | A string whose characters are in the reverse order of the given string |
|
|
405
405
|
|
|
406
406
|
Examples:
|
|
407
407
|
|
|
@@ -419,16 +419,16 @@ Split a string by the given separator.
|
|
|
419
419
|
|
|
420
420
|
Parameters:
|
|
421
421
|
|
|
422
|
-
|param|type|description|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
422
|
+
| param | type | description |
|
|
423
|
+
| ----------- | -------- | ------------------------- |
|
|
424
|
+
| `separator` | `String` | The separator to split on |
|
|
425
|
+
| `string` | `String` | The string to split |
|
|
426
426
|
|
|
427
427
|
Returns:
|
|
428
428
|
|
|
429
|
-
|type|description|
|
|
430
|
-
|
|
431
|
-
|
|
429
|
+
| type | description |
|
|
430
|
+
| --------------- | ---------------------------------------------- |
|
|
431
|
+
| `Array<String>` | An array of substrings from the initial string |
|
|
432
432
|
|
|
433
433
|
Throws:
|
|
434
434
|
|
|
@@ -464,17 +464,17 @@ Get a portion of a string.
|
|
|
464
464
|
|
|
465
465
|
Parameters:
|
|
466
466
|
|
|
467
|
-
|param|type|description|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
467
|
+
| param | type | description |
|
|
468
|
+
| -------- | -------- | -------------------------------------------- |
|
|
469
|
+
| `start` | `Number` | The start position of the substring |
|
|
470
|
+
| `?end` | `Number` | The end position of the substring, exclusive |
|
|
471
|
+
| `string` | `String` | The input string |
|
|
472
472
|
|
|
473
473
|
Returns:
|
|
474
474
|
|
|
475
|
-
|type|description|
|
|
476
|
-
|
|
477
|
-
|
|
475
|
+
| type | description |
|
|
476
|
+
| -------- | ------------------------------------- |
|
|
477
|
+
| `String` | The substring from the initial string |
|
|
478
478
|
|
|
479
479
|
Throws:
|
|
480
480
|
|
|
@@ -514,16 +514,16 @@ Check if a string contains a substring.
|
|
|
514
514
|
|
|
515
515
|
Parameters:
|
|
516
516
|
|
|
517
|
-
|param|type|description|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
517
|
+
| param | type | description |
|
|
518
|
+
| -------- | -------- | ---------------------- |
|
|
519
|
+
| `search` | `String` | The substring to check |
|
|
520
|
+
| `string` | `String` | The string to search |
|
|
521
521
|
|
|
522
522
|
Returns:
|
|
523
523
|
|
|
524
|
-
|type|description|
|
|
525
|
-
|
|
526
|
-
|
|
524
|
+
| type | description |
|
|
525
|
+
| ------ | ------------------------------------------------------------------------- |
|
|
526
|
+
| `Bool` | `true` if the input string contains the search value or `false` otherwise |
|
|
527
527
|
|
|
528
528
|
Examples:
|
|
529
529
|
|
|
@@ -546,16 +546,16 @@ Check if a string begins with another string.
|
|
|
546
546
|
|
|
547
547
|
Parameters:
|
|
548
548
|
|
|
549
|
-
|param|type|description|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
549
|
+
| param | type | description |
|
|
550
|
+
| -------- | -------- | ---------------------------------- |
|
|
551
|
+
| `search` | `String` | The string to compare to the start |
|
|
552
|
+
| `string` | `String` | The string to search |
|
|
553
553
|
|
|
554
554
|
Returns:
|
|
555
555
|
|
|
556
|
-
|type|description|
|
|
557
|
-
|
|
558
|
-
|
|
556
|
+
| type | description |
|
|
557
|
+
| ------ | ---------------------------------------------------------------------------- |
|
|
558
|
+
| `Bool` | `true` if the input string starts with the search value or `false` otherwise |
|
|
559
559
|
|
|
560
560
|
Examples:
|
|
561
561
|
|
|
@@ -578,16 +578,16 @@ Check if a string ends with another string.
|
|
|
578
578
|
|
|
579
579
|
Parameters:
|
|
580
580
|
|
|
581
|
-
|param|type|description|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
581
|
+
| param | type | description |
|
|
582
|
+
| -------- | -------- | -------------------------------- |
|
|
583
|
+
| `search` | `String` | The string to compare to the end |
|
|
584
|
+
| `string` | `String` | The string to search |
|
|
585
585
|
|
|
586
586
|
Returns:
|
|
587
587
|
|
|
588
|
-
|type|description|
|
|
589
|
-
|
|
590
|
-
|
|
588
|
+
| type | description |
|
|
589
|
+
| ------ | -------------------------------------------------------------------------- |
|
|
590
|
+
| `Bool` | `true` if the input string ends with the search value or `false` otherwise |
|
|
591
591
|
|
|
592
592
|
Examples:
|
|
593
593
|
|
|
@@ -611,17 +611,17 @@ Replaces the first appearance of the search pattern in the string with the repla
|
|
|
611
611
|
|
|
612
612
|
Parameters:
|
|
613
613
|
|
|
614
|
-
|param|type|description|
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
614
|
+
| param | type | description |
|
|
615
|
+
| --------------- | -------- | --------------------- |
|
|
616
|
+
| `searchPattern` | `String` | The string to replace |
|
|
617
|
+
| `replacement` | `String` | The replacement |
|
|
618
|
+
| `string` | `String` | The string to change |
|
|
619
619
|
|
|
620
620
|
Returns:
|
|
621
621
|
|
|
622
|
-
|type|description|
|
|
623
|
-
|
|
624
|
-
|
|
622
|
+
| type | description |
|
|
623
|
+
| -------- | --------------------------------------------------------------------- |
|
|
624
|
+
| `String` | A new string with the first occurrence of the search pattern replaced |
|
|
625
625
|
|
|
626
626
|
Examples:
|
|
627
627
|
|
|
@@ -645,17 +645,17 @@ Replaces the last appearance of the search pattern in the string with the replac
|
|
|
645
645
|
|
|
646
646
|
Parameters:
|
|
647
647
|
|
|
648
|
-
|param|type|description|
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
648
|
+
| param | type | description |
|
|
649
|
+
| --------------- | -------- | --------------------- |
|
|
650
|
+
| `searchPattern` | `String` | The string to replace |
|
|
651
|
+
| `replacement` | `String` | The replacement |
|
|
652
|
+
| `string` | `String` | The string to change |
|
|
653
653
|
|
|
654
654
|
Returns:
|
|
655
655
|
|
|
656
|
-
|type|description|
|
|
657
|
-
|
|
658
|
-
|
|
656
|
+
| type | description |
|
|
657
|
+
| -------- | -------------------------------------------------------------------- |
|
|
658
|
+
| `String` | A new string with the last occurrence of the search pattern replaced |
|
|
659
659
|
|
|
660
660
|
Examples:
|
|
661
661
|
|
|
@@ -679,17 +679,17 @@ Replaces every appearance of the search pattern in the string with the replaceme
|
|
|
679
679
|
|
|
680
680
|
Parameters:
|
|
681
681
|
|
|
682
|
-
|param|type|description|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
682
|
+
| param | type | description |
|
|
683
|
+
| --------------- | -------- | --------------------- |
|
|
684
|
+
| `searchPattern` | `String` | The string to replace |
|
|
685
|
+
| `replacement` | `String` | The replacement |
|
|
686
|
+
| `string` | `String` | The string to change |
|
|
687
687
|
|
|
688
688
|
Returns:
|
|
689
689
|
|
|
690
|
-
|type|description|
|
|
691
|
-
|
|
692
|
-
|
|
690
|
+
| type | description |
|
|
691
|
+
| -------- | ---------------------------------------------------------------- |
|
|
692
|
+
| `String` | A new string with each occurrence of the search pattern replaced |
|
|
693
693
|
|
|
694
694
|
Examples:
|
|
695
695
|
|
|
@@ -721,19 +721,19 @@ Encodes the given string into a byte sequence at the supplied position using the
|
|
|
721
721
|
|
|
722
722
|
Parameters:
|
|
723
723
|
|
|
724
|
-
|param|type|description|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
724
|
+
| param | type | description |
|
|
725
|
+
| ------------- | ---------- | ---------------------------------------------------------------- |
|
|
726
|
+
| `string` | `String` | The input string |
|
|
727
|
+
| `encoding` | `Encoding` | The encoding to use |
|
|
728
|
+
| `dest` | `Bytes` | The byte sequence that will be copied |
|
|
729
|
+
| `destPos` | `Number` | The location in the byte sequence to write the output |
|
|
730
|
+
| `?includeBom` | `Bool` | Whether or not to include a byte order marker (false by default) |
|
|
731
731
|
|
|
732
732
|
Returns:
|
|
733
733
|
|
|
734
|
-
|type|description|
|
|
735
|
-
|
|
736
|
-
|
|
734
|
+
| type | description |
|
|
735
|
+
| ------- | -------------------------------------------------------------------------------- |
|
|
736
|
+
| `Bytes` | A copy of the input bytes with the encoded string replaced at the given position |
|
|
737
737
|
|
|
738
738
|
Throws:
|
|
739
739
|
|
|
@@ -764,17 +764,17 @@ Encodes the given string using the given encoding scheme.
|
|
|
764
764
|
|
|
765
765
|
Parameters:
|
|
766
766
|
|
|
767
|
-
|param|type|description|
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
767
|
+
| param | type | description |
|
|
768
|
+
| ------------- | ---------- | ---------------------------------------------------------------- |
|
|
769
|
+
| `string` | `String` | The input string |
|
|
770
|
+
| `encoding` | `Encoding` | The encoding to use |
|
|
771
|
+
| `?includeBom` | `Bool` | Whether or not to include a byte order marker (false by default) |
|
|
772
772
|
|
|
773
773
|
Returns:
|
|
774
774
|
|
|
775
|
-
|type|description|
|
|
776
|
-
|
|
777
|
-
|
|
775
|
+
| type | description |
|
|
776
|
+
| ------- | ----------------------------------------------------------- |
|
|
777
|
+
| `Bytes` | The byte representation of the string in the given encoding |
|
|
778
778
|
|
|
779
779
|
### String.**decodeRange**
|
|
780
780
|
|
|
@@ -800,19 +800,19 @@ Decodes the given byte sequence of the specified range into a string using the e
|
|
|
800
800
|
|
|
801
801
|
Parameters:
|
|
802
802
|
|
|
803
|
-
|param|type|description|
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
803
|
+
| param | type | description |
|
|
804
|
+
| ---------- | ---------- | ---------------------------------------------------------------- |
|
|
805
|
+
| `bytes` | `Bytes` | The input bytes |
|
|
806
|
+
| `encoding` | `Encoding` | The encoding to use |
|
|
807
|
+
| `start` | `Number` | The byte offset to begin decoding from |
|
|
808
|
+
| `size` | `Number` | The maximum number of bytes to decode |
|
|
809
|
+
| `?keepBom` | `Bool` | Whether or not to include a byte order marker (false by default) |
|
|
810
810
|
|
|
811
811
|
Returns:
|
|
812
812
|
|
|
813
|
-
|type|description|
|
|
814
|
-
|
|
815
|
-
|
|
813
|
+
| type | description |
|
|
814
|
+
| -------- | ------------------ |
|
|
815
|
+
| `String` | The decoded string |
|
|
816
816
|
|
|
817
817
|
Throws:
|
|
818
818
|
|
|
@@ -845,17 +845,17 @@ Decodes the given byte sequence into a string using the given encoding scheme.
|
|
|
845
845
|
|
|
846
846
|
Parameters:
|
|
847
847
|
|
|
848
|
-
|param|type|description|
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
848
|
+
| param | type | description |
|
|
849
|
+
| ---------- | ---------- | ---------------------------------------------------------------- |
|
|
850
|
+
| `bytes` | `Bytes` | The input bytes |
|
|
851
|
+
| `encoding` | `Encoding` | The encoding to use |
|
|
852
|
+
| `?keepBom` | `Bool` | Whether or not to include a byte order marker (false by default) |
|
|
853
853
|
|
|
854
854
|
Returns:
|
|
855
855
|
|
|
856
|
-
|type|description|
|
|
857
|
-
|
|
858
|
-
|
|
856
|
+
| type | description |
|
|
857
|
+
| -------- | ------------------ |
|
|
858
|
+
| `String` | The decoded string |
|
|
859
859
|
|
|
860
860
|
### String.**forEachCodePoint**
|
|
861
861
|
|
|
@@ -872,10 +872,10 @@ Iterates over Unicode code points in a string.
|
|
|
872
872
|
|
|
873
873
|
Parameters:
|
|
874
874
|
|
|
875
|
-
|param|type|description|
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
875
|
+
| param | type | description |
|
|
876
|
+
| ----- | ---------------- | --------------------- |
|
|
877
|
+
| `fn` | `Number => Void` | The iterator function |
|
|
878
|
+
| `str` | `String` | The string to iterate |
|
|
879
879
|
|
|
880
880
|
Examples:
|
|
881
881
|
|
|
@@ -900,10 +900,10 @@ as the second argument to the iterator function.
|
|
|
900
900
|
|
|
901
901
|
Parameters:
|
|
902
902
|
|
|
903
|
-
|param|type|description|
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
903
|
+
| param | type | description |
|
|
904
|
+
| ----- | -------------------------- | --------------------- |
|
|
905
|
+
| `fn` | `(Number, Number) => Void` | The iterator function |
|
|
906
|
+
| `str` | `String` | The string to iterate |
|
|
907
907
|
|
|
908
908
|
Examples:
|
|
909
909
|
|
|
@@ -926,10 +926,10 @@ Iterates over Unicode characters in a string.
|
|
|
926
926
|
|
|
927
927
|
Parameters:
|
|
928
928
|
|
|
929
|
-
|param|type|description|
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
929
|
+
| param | type | description |
|
|
930
|
+
| ----- | -------------- | --------------------- |
|
|
931
|
+
| `fn` | `Char => Void` | The iterator function |
|
|
932
|
+
| `str` | `String` | The string to iterate |
|
|
933
933
|
|
|
934
934
|
Examples:
|
|
935
935
|
|
|
@@ -954,10 +954,10 @@ as the second argument to the iterator function.
|
|
|
954
954
|
|
|
955
955
|
Parameters:
|
|
956
956
|
|
|
957
|
-
|param|type|description|
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
957
|
+
| param | type | description |
|
|
958
|
+
| ----- | ------------------------ | --------------------- |
|
|
959
|
+
| `fn` | `(Char, Number) => Void` | The iterator function |
|
|
960
|
+
| `str` | `String` | The string to iterate |
|
|
961
961
|
|
|
962
962
|
Examples:
|
|
963
963
|
|
|
@@ -980,10 +980,10 @@ Builds a new string by mapping Unicode characters.
|
|
|
980
980
|
|
|
981
981
|
Parameters:
|
|
982
982
|
|
|
983
|
-
|param|type|description|
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
983
|
+
| param | type | description |
|
|
984
|
+
| ----- | -------------- | -------------------- |
|
|
985
|
+
| `fn` | `Char => Char` | The mapping function |
|
|
986
|
+
| `str` | `String` | The string to map |
|
|
987
987
|
|
|
988
988
|
Examples:
|
|
989
989
|
|
|
@@ -1008,10 +1008,10 @@ as the second argument to the mapping function.
|
|
|
1008
1008
|
|
|
1009
1009
|
Parameters:
|
|
1010
1010
|
|
|
1011
|
-
|param|type|description|
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1011
|
+
| param | type | description |
|
|
1012
|
+
| ----- | ------------------------ | -------------------- |
|
|
1013
|
+
| `fn` | `(Char, Number) => Char` | The mapping function |
|
|
1014
|
+
| `str` | `String` | The string to map |
|
|
1015
1015
|
|
|
1016
1016
|
Examples:
|
|
1017
1017
|
|
|
@@ -1034,15 +1034,15 @@ Trims the beginning of a string—removing any leading whitespace characters.
|
|
|
1034
1034
|
|
|
1035
1035
|
Parameters:
|
|
1036
1036
|
|
|
1037
|
-
|param|type|description|
|
|
1038
|
-
|
|
1039
|
-
|
|
1037
|
+
| param | type | description |
|
|
1038
|
+
| -------- | -------- | ------------------------ |
|
|
1039
|
+
| `string` | `String` | The string to be trimmed |
|
|
1040
1040
|
|
|
1041
1041
|
Returns:
|
|
1042
1042
|
|
|
1043
|
-
|type|description|
|
|
1044
|
-
|
|
1045
|
-
|
|
1043
|
+
| type | description |
|
|
1044
|
+
| -------- | ------------------ |
|
|
1045
|
+
| `String` | The trimmed string |
|
|
1046
1046
|
|
|
1047
1047
|
Examples:
|
|
1048
1048
|
|
|
@@ -1065,15 +1065,15 @@ Trims the end of a string—removing any trailing whitespace characters.
|
|
|
1065
1065
|
|
|
1066
1066
|
Parameters:
|
|
1067
1067
|
|
|
1068
|
-
|param|type|description|
|
|
1069
|
-
|
|
1070
|
-
|
|
1068
|
+
| param | type | description |
|
|
1069
|
+
| -------- | -------- | ------------------------ |
|
|
1070
|
+
| `string` | `String` | The string to be trimmed |
|
|
1071
1071
|
|
|
1072
1072
|
Returns:
|
|
1073
1073
|
|
|
1074
|
-
|type|description|
|
|
1075
|
-
|
|
1076
|
-
|
|
1074
|
+
| type | description |
|
|
1075
|
+
| -------- | ------------------ |
|
|
1076
|
+
| `String` | The trimmed string |
|
|
1077
1077
|
|
|
1078
1078
|
Examples:
|
|
1079
1079
|
|
|
@@ -1096,15 +1096,15 @@ Trims a string—removing all leading and trailing whitespace characters.
|
|
|
1096
1096
|
|
|
1097
1097
|
Parameters:
|
|
1098
1098
|
|
|
1099
|
-
|param|type|description|
|
|
1100
|
-
|
|
1101
|
-
|
|
1099
|
+
| param | type | description |
|
|
1100
|
+
| -------- | -------- | ------------------------ |
|
|
1101
|
+
| `string` | `String` | The string to be trimmed |
|
|
1102
1102
|
|
|
1103
1103
|
Returns:
|
|
1104
1104
|
|
|
1105
|
-
|type|description|
|
|
1106
|
-
|
|
1107
|
-
|
|
1105
|
+
| type | description |
|
|
1106
|
+
| -------- | ------------------ |
|
|
1107
|
+
| `String` | The trimmed string |
|
|
1108
1108
|
|
|
1109
1109
|
Examples:
|
|
1110
1110
|
|
|
@@ -1127,15 +1127,15 @@ Converts all ASCII uppercase characters in the string to lowercase.
|
|
|
1127
1127
|
|
|
1128
1128
|
Parameters:
|
|
1129
1129
|
|
|
1130
|
-
|param|type|description|
|
|
1131
|
-
|
|
1132
|
-
|
|
1130
|
+
| param | type | description |
|
|
1131
|
+
| -------- | -------- | --------------------- |
|
|
1132
|
+
| `string` | `String` | The string to convert |
|
|
1133
1133
|
|
|
1134
1134
|
Returns:
|
|
1135
1135
|
|
|
1136
|
-
|type|description|
|
|
1137
|
-
|
|
1138
|
-
|
|
1136
|
+
| type | description |
|
|
1137
|
+
| -------- | --------------------- |
|
|
1138
|
+
| `String` | The lowercased string |
|
|
1139
1139
|
|
|
1140
1140
|
Examples:
|
|
1141
1141
|
|
|
@@ -1158,15 +1158,15 @@ Converts all ASCII lowercase characters in the string to uppercase.
|
|
|
1158
1158
|
|
|
1159
1159
|
Parameters:
|
|
1160
1160
|
|
|
1161
|
-
|param|type|description|
|
|
1162
|
-
|
|
1163
|
-
|
|
1161
|
+
| param | type | description |
|
|
1162
|
+
| -------- | -------- | --------------------- |
|
|
1163
|
+
| `string` | `String` | The string to convert |
|
|
1164
1164
|
|
|
1165
1165
|
Returns:
|
|
1166
1166
|
|
|
1167
|
-
|type|description|
|
|
1168
|
-
|
|
1169
|
-
|
|
1167
|
+
| type | description |
|
|
1168
|
+
| -------- | --------------------- |
|
|
1169
|
+
| `String` | The uppercased string |
|
|
1170
1170
|
|
|
1171
1171
|
Examples:
|
|
1172
1172
|
|
|
@@ -1189,16 +1189,16 @@ Produces a new string by repeating a substring a given number of times.
|
|
|
1189
1189
|
|
|
1190
1190
|
Parameters:
|
|
1191
1191
|
|
|
1192
|
-
|param|type|description|
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1192
|
+
| param | type | description |
|
|
1193
|
+
| -------- | -------- | ---------------------------------------- |
|
|
1194
|
+
| `count` | `Number` | The number of times to repeat the string |
|
|
1195
|
+
| `string` | `String` | The string to repeat |
|
|
1196
1196
|
|
|
1197
1197
|
Returns:
|
|
1198
1198
|
|
|
1199
|
-
|type|description|
|
|
1200
|
-
|
|
1201
|
-
|
|
1199
|
+
| type | description |
|
|
1200
|
+
| -------- | --------------------------------------------- |
|
|
1201
|
+
| `String` | A string containing the repeated input string |
|
|
1202
1202
|
|
|
1203
1203
|
Throws:
|
|
1204
1204
|
|