String Transformation
Functions for converting case, encoding, escaping, and type conversion.
| Function |
Method Alias |
Description |
LowerCase(s) |
.ToLower / .LowerCase |
Converts to lowercase (Unicode). |
ASCIILowerCase(s) |
- |
Converts to lowercase (ASCII only). |
UpperCase(s) |
.ToUpper / .UpperCase |
Converts to uppercase (Unicode). |
ASCIIUpperCase(s) |
- |
Converts to uppercase (ASCII only). |
Trim(s) |
.Trim |
Removes whitespace from both ends. |
Trim(s, L, R) |
.Trim(L, R) |
Removes L chars from left and R from right. |
TrimLeft(s) / TrimRight(s) |
.TrimLeft / .TrimRight |
Removes whitespace from one end. |
PadLeft(s, len [, ch]) |
.PadLeft(len [, ch]) |
Pads string to len with character ch. |
PadRight(s, len [, ch]) |
.PadRight(len [, ch]) |
Pads string to len with character ch. |
StrReplace(s, old, new) |
.Replace(old, new) |
Replaces all occurrences of old with new. |
ReverseString(s) |
.Reverse |
Reverses the character order. |
DupeString(s, count) |
.Dupe(count) |
Returns the string repeated count times. |
NormalizeString(s) |
.Normalize |
Normalizes Unicode string (NFC default). |
StripAccents(s) |
.StripAccents |
Removes diacritics (e.g. é -> e). |
| Function |
Method Alias |
Description |
IntToHex(v, digits) |
.ToHexString(digits) |
Integer to hexadecimal string. |
IntToBin(v, digits) |
.ToBinaryString(digits) |
Integer to binary string. |
HexToInt(s) |
.HexToInteger |
Hexadecimal string to integer. |
FloatToStr(f [, p]) |
.ToString |
Float to string (optional precision p). |
ByteSizeToStr(v) |
- |
Converts a number of bytes into human-readable size (e.g. "1.5 MB"). |
BoolToStr(b) |
.ToString |
Boolean to "True" or "False". |
StrToBool(s) |
.ToBoolean |
String to boolean. |
| Function |
Method Alias |
Description |
StrToHtml(s) |
.ToHtml |
HTML entity encoding. |
StrToHtmlAttribute(s) |
.ToHtmlAttribute |
HTML attribute encoding. |
StrToJSON(s) |
.ToJSON |
Escapes string for JSON/JavaScript literal. |
StrToCSSText(s) |
.ToCSSText |
Escapes string for CSS content. |
StrToXML(s) |
.ToXML |
XML text encoding. |
QuotedStr(s [, quote]) |
.QuotedString |
Wraps string in quotes (default '). |
NormalizeString(s [, form]) |
.Normalize |
Unicode normalization (NFC, NFD, etc). |
StrIsASCII(s) |
.IsASCII |
Returns True if all characters in the string are ASCII (0..127). |