Skip to main content

b62_encode

Encodes an integer into a Base62 string representation, supporting both positive and negative values.

def b62_encode(
s: int
) - > string

Encodes an integer into a Base62 string representation using the standard alphanumeric character set. This is typically used to generate short, URL-friendly identifiers from numeric database IDs.

Parameters

NameTypeDescription
sintThe integer value to be converted into Base62 format.

Returns

TypeDescription
stringThe Base62 encoded string, including a leading negative sign if the input integer was less than zero.