Core functions for handling string length, substrings, modification, and structure.
| Function | Method Alias | Description |
|---|---|---|
Length(s) |
.Length |
Returns the number of characters in the string. |
SetLength(var s, len) |
.SetLength(len) |
Resizes the string to len characters. |
Copy(s, idx [, len]) |
.Copy(idx [, len]) |
Returns a substring starting at 1-based idx. |
Delete(var s, idx, len) |
- | Removes len characters from string variable s. |
Insert(src, var s, idx) |
- | Inserts src into string variable s at idx. |
Pos(sub, s [, offset]) |
- | Returns 1-based index of first occurrence. |
RevPos(sub, s) |
- | Returns 1-based index of last occurrence. |
StrFind(s, sub [, from]) |
.IndexOf(sub [, from]) |
Returns 1-based index of sub in s. |
StrDeleteLeft(s, n) |
.DeleteLeft(n) |
Deletes n characters from the left. |
StrDeleteRight(s, n) |
.DeleteRight(n) |
Deletes n characters from the right. |
StrContains(s, sub) |
.Contains(sub) |
True if sub is present in s. |
StrBeginsWith(s, sub) |
.StartsWith(sub) |
True if s starts with sub. |
StrEndsWith(s, sub) |
.EndsWith(sub) |
True if s ends with sub. |
StrCount(sub, s) |
.Count(sub) |
Returns number of occurrences of sub in s. |
StrMatches(s, mask) |
.Matches(mask) |
Wildcard matching (* and ?). |
These functions simplify extracting parts of a string relative to a delimiter.
| Function | Method Alias | Description |
|---|---|---|
StrBefore(s, delim) |
.Before(delim) |
Text before the first occurrence of delim. |
StrBeforeLast(s, delim) |
.BeforeLast(delim) |
Text before the last occurrence of delim. |
StrAfter(s, delim) |
.After(delim) |
Text after the first occurrence of delim. |
StrAfterLast(s, delim) |
.AfterLast(delim) |
Text after the last occurrence of delim. |
StrBetween(s, start, stop) |
.Between(start, stop) |
Text between start and stop delimiters. |
LeftStr(s, count) |
.Left(count) |
Returns the first count characters. |
RightStr(s, count) |
.Right(count) |
Returns the last count characters. |
MidStr(s, start, len) |
- | Returns len characters from start. |
SubStr(s, start, len) |
- | Alias for MidStr. |
SubString(s, start, end) |
- | Text from start to end (exclusive of end). |
For type conversions (like FloatToStr, IntToStr) and case transformations, see String Transformation.
| Function | Method Alias | Description |
|---|---|---|
StrSplit(s, delim) |
.Split(delim) |
Splits string into an array of String. |
StrJoin(arr, delim) |
.Join(delim) |
Joins an array into a single string. |
StrArrayPack(arr) |
.Pack |
Removes empty strings from an array. |
var csv := 'apple,banana,cherry';
var fruits := csv.Split(',');
var joined := fruits.Join('; ');
PrintLn(joined); apple; banana; cherry