-
Notifications
You must be signed in to change notification settings - Fork 1
StdLib String
Roger Johansson edited this page Jan 14, 2026
·
1 revision
The String built-in provides methods for creating and manipulating text.
Implementation Status: 100% Complete
| Category | Methods | Implemented |
|---|---|---|
| Static Methods | 4 | 4 |
| Character Access | 4 | 4 |
| Search Methods | 6 | 6 |
| Substring Methods | 3 | 3 |
| Transformation Methods | 12 | 12 |
| Pattern Matching | 5 | 5 |
| Unicode Methods | 3 | 3 |
| HTML Wrappers (Annex B) | 13 | 13 |
| Total | 50 | 50 |
| Method | Status | Description |
|---|---|---|
String.fromCodePoint(...codePoints) |
Implemented | Creates string from code points (surrogate pairs) |
String.fromCharCode(...codes) |
Implemented | Creates string from UTF-16 code units |
String.raw(template, ...subs) |
Implemented | Raw template literal tag |
String.escape(string) |
Implemented | URL encoding (non-standard) |
| Method | Status | Description |
|---|---|---|
charAt(index) |
Implemented | Returns character at index |
charCodeAt(index) |
Implemented | Returns UTF-16 code unit |
codePointAt(index) |
Implemented | Returns code point (handles surrogates) |
at(index) |
Implemented | Relative indexing (ES2022) |
| Method | Status | Description |
|---|---|---|
indexOf(searchValue, fromIndex) |
Implemented | Finds first occurrence |
lastIndexOf(searchValue, fromIndex) |
Implemented | Finds last occurrence |
includes(searchValue, fromIndex) |
Implemented | Checks if contains substring |
startsWith(searchValue, position) |
Implemented | Checks prefix |
endsWith(searchValue, length) |
Implemented | Checks suffix |
search(regexp) |
Implemented | Symbol.search support |
| Method | Status | Description |
|---|---|---|
substring(start, end) |
Implemented | Extracts substring (swaps if needed) |
slice(start, end) |
Implemented | Extracts substring (negative indices) |
substr(start, length) |
Implemented | Extracts by length (deprecated) |
| Method | Status | Description |
|---|---|---|
concat(...strings) |
Implemented | Concatenates strings |
toLowerCase() |
Implemented | Converts to lowercase |
toUpperCase() |
Implemented | Converts to uppercase |
toLocaleLowerCase(locale) |
Implemented | Locale-aware lowercase |
toLocaleUpperCase(locale) |
Implemented | Locale-aware uppercase |
trim() |
Implemented | Removes whitespace from both ends |
trimStart() |
Implemented | Removes leading whitespace |
trimEnd() |
Implemented | Removes trailing whitespace |
repeat(count) |
Implemented | Repeats string |
padStart(targetLength, padString) |
Implemented | Pads at start |
padEnd(targetLength, padString) |
Implemented | Pads at end |
normalize(form) |
Implemented | Unicode normalization (NFC/NFD/NFKC/NFKD) |
-
trimLeft()->trimStart() -
trimRight()->trimEnd()
| Method | Status | Description |
|---|---|---|
split(separator, limit) |
Implemented | Symbol.split support |
replace(pattern, replacement) |
Implemented | RegExp and function replacer |
replaceAll(pattern, replacement) |
Implemented | Global replacement (ES2021) |
match(regexp) |
Implemented | Symbol.match support |
matchAll(regexp) |
Implemented | Symbol.matchAll iterator (ES2020) |
| Method | Status | Description |
|---|---|---|
isWellFormed() |
Implemented | Checks for lone surrogates (ES2024) |
toWellFormed() |
Implemented | Replaces lone surrogates with U+FFFD (ES2024) |
localeCompare(that, locales, options) |
Implemented | Locale-aware comparison |
| Method | Status | Description |
|---|---|---|
[Symbol.iterator]() |
Implemented | Iterates by code point (not UTF-16) |
| Method | Status | Description |
|---|---|---|
anchor(name) |
Implemented | <a name="..."> |
big() |
Implemented | <big> |
blink() |
Implemented | <blink> |
bold() |
Implemented | <b> |
fixed() |
Implemented | <tt> |
fontcolor(color) |
Implemented | <font color="..."> |
fontsize(size) |
Implemented | <font size="..."> |
italics() |
Implemented | <i> |
link(href) |
Implemented | <a href="..."> |
small() |
Implemented | <small> |
strike() |
Implemented | <strike> |
sub() |
Implemented | <sub> |
sup() |
Implemented | <sup> |
Strings iterate by code point, not UTF-16 code unit:
const emoji = "😀"; // U+1F600, surrogate pair
for (const char of emoji) {
console.log(char); // "😀" (single iteration)
}String methods delegate to Symbol methods on RegExp:
-
split()->regexp[Symbol.split]() -
match()->regexp[Symbol.match]() -
matchAll()->regexp[Symbol.matchAll]() -
replace()->regexp[Symbol.replace]() -
search()->regexp[Symbol.search]()
| File | Purpose |
|---|---|
StdLib/String/StringConstructor.cs |
Static methods |
StdLib/String/StringPrototype.cs |
Prototype methods |
StdLib/String/StringHelper.cs |
Internal helpers |
- StdLib-RegExp - Regular expression support
- Iterator-Protocol - String iteration