uCalc API Version: 2.1.3-preview.2 Released: 6/17/2026

Warning

uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.

Strings

Product: 

Class: 

Remarks

🧵 Basic String Operations

FunctionDescription
Repeat(string, size_t) As StringReturns a new string consisting of the first argument repeated y times.
Append(string, string)Appends the second string to the first (mutating).
Append_Copy(string, string) As StringReturns a new string equal to x + y without modifying the original.
Insert(string, size_t, string)Inserts substring z into x at index y (mutating).
Insert_Copy(string, size_t, string) As StringReturns a new string with z inserted at index y.
Erase(string, size_t = 0, size_t = 0)Removes a substring from x starting at y of length z (mutating).
Erase_Copy(string, size_t = 0, size_t = 0) As StringReturns a new string with the specified range removed.
Fill(size_t, uint8_t) As StringCreates a string of length x filled with byte y.
Replace(string, size_t, size_t, string)Replaces a substring in a starting at b of length c with d (mutating).
Replace_Copy(string, size_t, size_t, string) As StringReturns a new string with the replacement applied.
Substr(string, size_t = 0, size_t = 0) As StringReturns a substring starting at y of length z.
Length(string) As Size_tReturns the number of characters in the string.
C_Str(string) As Int8u PtrReturns a pointer to the underlying C‑style character buffer.
Str(anytype) As StringConverts any type to a string.

🔤 Case & Trimming

FunctionDescription
LCase(string) As StringConverts all characters to lowercase.
UCase(string) As StringConverts all characters to uppercase.
LTrim(string, string = "") As StringRemoves leading whitespace or specified characters.
RTrim(string, string = "") As StringRemoves trailing whitespace or specified characters.
Trim(string, string = "") As StringRemoves leading and trailing whitespace or specified characters.

🔢 Numeric Conversions

FunctionDescription
Bin(int) As StringConverts an integer to a binary string.
Oct(int) As StringConverts an integer to an octal string.
Hex(int) As StringConverts an integer to a hexadecimal string.

📁 File Utilities

FunctionDescription
File(string) As StringReads the entire contents of a file into a string.
FileSize(string) As Size_tReturns the size of a file in bytes.

🔣 Character Functions

FunctionDescription
Chr(size_t) As StringConverts a numeric code point to a single‑character string.
Asc(string) As Size_tReturns the code point of the first character.
Asc(string, size_t) As Size_tReturns the code point at position Pos (1‑based). Equivalent to Asc(Substr(s, Pos - 1, 1)).

🧮 Comparisons & Aggregates

FunctionDescription
Min(string ...) As StringReturns the lexicographically smallest string.
Max(string ...) As StringReturns the lexicographically largest string.
Compare(string, string) As Size_tCompares two strings lexicographically (typically returns <0, 0, or >0).

🔍 Search & Predicates

FunctionDescription
Contains(string, string, size_t = 0) As BoolReturns true if the substring exists in txt starting at offset z.
StartsWith(string, string) As BoolReturns true if the string begins with the given prefix.
EndsWith(string, string) As BoolReturns true if the string ends with the given suffix.
IndexOf(string, string, size_t = 0) As Size_tFinds the first occurrence of y in x starting at z.
LastIndexOf(string, string, size_t = 0) As Size_tFinds the last occurrence of y in x starting backward from z.
Find_First_Of(string, string, size_t = 0) As Size_tFinds the first character in x that matches any in y.
Find_Last_Of(string, string, size_t = 0) As Size_tFinds the last character in x that matches any in y.
Find_First_Not_Of(string, string, size_t = 0) As Size_tFinds the first character in x not in y.
Find_Last_Not_Of(string, string, size_t = 0) As Size_tFinds the last character in x not in y.

📏 Padding & Formatting

FunctionDescription
PadLeft(string, size_t, string) As StringPads the string on the left to reach the specified width.
PadRight(string, size_t, string) As StringPads the string on the right (you listed PadLeft twice; I assume one is PadRight).
Format(string, string) As StringFormats a string using a format specifier.
Format(string, int) As StringFormats an integer using a format specifier.
Format(string, double) As StringFormats a floating‑point value using a format specifier.

Format functions are based on C++ standard library std::format. A number of others are also based on C++ string functions. Others are somewhat similar to C# functions.

Examples