diff --git a/modules/core/string.html b/modules/core/string.html index 598f1bb7..670f4dd3 100644 --- a/modules/core/string.html +++ b/modules/core/string.html @@ -185,24 +185,9 @@ count as well.

negative to count backwards from the end of the string.

It is a runtime error if search is not a string or start is not an integer index within the string’s byte length.

-

split(separator) #

-

Returns a list of one or more strings separated by separator.

-
var string = "abc abc abc" 
-System.print(string.split(" ")) [abc, abc, abc]
-
- - -

It is a runtime error if separator is not a string or is an empty string.

-

replace(old, swap) #

-

Returns a new string with all occurences of old replaced with swap.

-
var string = "abc abc abc" 
-System.print(string.replace(" ", "")) abcabcabc
-
- -

iterate(iterator), iteratorValue(iterator) #

-

Implements the iterator protocol -for iterating over the code points in the string:

+

Implements the iterator protocol for iterating over the code points in the +string:

var codePoints = [] 
 for (c in "(ᵔᴥᵔ)") { 
   codePoints.add(c) 
@@ -214,9 +199,62 @@ for iterating over the code points in the string: 

If the string contains any bytes that are not valid UTF-8, this iterates over those too, one byte at a time.

+

replace(old, swap) #

+

Returns a new string with all occurrences of old replaced with swap.

+
var string = "abc abc abc" 
+System.print(string.replace(" ", "")) abcabcabc
+
+ + +

split(separator) #

+

Returns a list of one or more strings separated by separator.

+
var string = "abc abc abc" 
+System.print(string.split(" ")) [abc, abc, abc]
+
+ + +

It is a runtime error if separator is not a string or is an empty string.

startsWith(prefix) #

Checks if the string starts with prefix.

It is a runtime error if prefix is not a string.

+

trim() #

+

Returns a new string with whitespace removed from the beginning and end of this +string. “Whitespace” is space, tab, carriage return, and line feed characters.

+
System.print(" \nstuff\r\t".trim()) stuff
+
+ + +

trim(chars) #

+

Returns a new string with all code points in chars removed from the beginning +and end of this string.

+
System.print("ᵔᴥᵔᴥᵔbearᵔᴥᴥᵔᵔ".trim("ᵔᴥ")) bear
+
+ + +

trimEnd() #

+

Like trim() but only removes from the end of the string.

+
System.print(" \nstuff\r\t".trimEnd()) " \nstuff"
+
+ + +

trimEnd(chars) #

+

Like trim() but only removes from the end of the string.

+
System.print("ᵔᴥᵔᴥᵔbearᵔᴥᴥᵔᵔ".trimEnd("ᵔᴥ")) ᵔᴥᵔᴥᵔbear
+
+ + +

trimStart() #

+

Like trim() but only removes from the beginning of the string.

+
System.print(" \nstuff\r\t".trimStart()) "stuff\r\t"
+
+ + +

trimStart(chars) #

+

Like trim() but only removes from the beginning of the string.

+
System.print("ᵔᴥᵔᴥᵔbearᵔᴥᴥᵔᵔ".trimStart("ᵔᴥ")) bearᵔᴥᴥᵔᵔ
+
+ +

+(other) operator #

Returns a new string that concatenates this string and other.

It is a runtime error if other is not a string.