Skip to main content

str.capitalize

Return a copy of the expression with the first character capitalized and the rest lowercased.

str.center

Return the expression centered in a string of length width. Padding is done using the specified fill character.
width
int | IntegerValue
required
fillchar
str | StringValue | None

str.contains

Return True if the expression contains the substring and False otherwise.
substr
str | StringValue
required

str.convert_base

Convert the expression from one base to another.
from_base
IntegerValue
required
to_base
IntegerValue
required

str.endswith

Return True if the expression ends with the specified suffix and False otherwise.
end
str | StringValue
required

str.find

Return the position of the first occurrence of substring. Search is limited to the specified start and end positions, if provided. All indexes are 0-based.
substr
str | StringValue
required
start
int | IntegerValue | None
end
int | IntegerValue | None

str.find_in_set

Return the position of the first occurrence of the expression in the list of strings.
str_list
list[str]
required

str.format

Return a formatted string using the expression as a format string. Note that only a subset of the python format string syntax is supported.
*Supported*
- {0}, {1}, .. {n} for args replacements
- {key} for kwargs replacements

**Not Supported**
- conversion flags (e.g. "Harold's a clever {0\!s}")
- implicit references (e.g. "From {} to {}")
- positional arguments / attributes (e.g. {0.weight} or {players[0]})
args
Any
required
kwargs
Any
required

str.hash

Return the hash of the expression using the specified algorithm.
algorithm
Literal['md5', 'sha1', 'sha256', 'sha512']
default:"sha256"
return_type
Literal['bytes', 'hex']
default:"hex"

str.join

Concatenate the elements of the list using the provided separator.
strings
list[str | StringValue]
required

str.len

Return the number of non-overlapping occurrences of substring in the expression.
substr
str | StringValue
required

str.levenshtein

Return the Levenshtein distance between the expression and the other string.
other
str | StringValue
required

str.ljust

Return the expression padded with the provided fill character to the specified length.
length
int | IntegerValue
required
fillchar
str | StringValue | None
default:" "

str.lower

Return a copy of the expression with all characters lowercased.

str.lstrip

Return a copy of the expression with leading whitespace removed. Note: doesn’t support removing specific characters like the standard library function.

str.ord

Return the unicode code point of the first character of the expression.

str.repeat

Return the expression repeated n times.
n
int | IntegerValue
required

str.replace

Replace the matches of an exact (non-regex) pattern with a replacement string.
pattern
str | StringValue
required
replacement
str | StringValue
required

str.reverse

Return a copy of the expression with the characters reversed.

str.rjust

Return the expression padded with the provided fill character to the specified length.
length
int | IntegerValue
required
fillchar
str | StringValue | None
default:" "

str.rstrip

Return a copy of the expression with trailing whitespace removed. Note: doesn’t support removing specific characters like the standard library function.

str.split

Split the expression using the specified delimiter.
delimiter
str | StringValue
required

str.startswith

Return True if the expression starts with the specified prefix and False otherwise.
start
str | StringValue
required

str.strip

Return a copy of the expression with leading and trailing whitespace removed.

str.to_strptime

Parse a string into a timestamp using the specified strptime format.
format
str | StringValue
required
I