Skip to main content

stringformat

Format the variable according to the arg, a string formatting specifier.

This specifier uses Python string formatting syntax, with the exception that the leading "%" is dropped.

See https://docs.python.org/library/stdtypes.html#printf-style-string-formatting for documentation of Python string formatting.

def stringformat(
value: any,
arg: string
) - > string

Format the variable according to the arg, a string formatting specifier. This specifier uses Python string formatting syntax, with the exception that the leading "%" is dropped.

Parameters

NameTypeDescription
valueanyThe variable to be formatted; if a tuple is provided, it is converted to its string representation before formatting.
argstringThe Python printf-style formatting specifier (excluding the leading percent sign) used to format the value.

Returns

TypeDescription
stringThe formatted string resulting from the printf-style operation, or an empty string if formatting fails due to type or value errors.