/** * Python string module for TypeScript * * Provides string constants and utility classes matching Python's string module, * including ascii_letters, digits, punctuation, and the Template class. * * @see {@link https://docs.python.org/3/library/string.html | Python string documentation} * @module */ /** The lowercase letters 'abcdefghijklmnopqrstuvwxyz' */ declare const asciiLowercase = "abcdefghijklmnopqrstuvwxyz"; /** The uppercase letters 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' */ declare const asciiUppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; /** The concatenation of asciiLowercase and asciiUppercase */ declare const asciiLetters: string; /** The string '0123456789' */ declare const digits = "0123456789"; /** The string '0123456789abcdefABCDEF' */ declare const hexDigits = "0123456789abcdefABCDEF"; /** The string '01234567' */ declare const octDigits = "01234567"; /** String of ASCII characters which are considered punctuation */ declare const punctuation = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"; /** String of ASCII characters which are considered whitespace */ declare const whitespace = " \t\n\r\v\f"; /** String of ASCII characters which are considered printable */ declare const printable: string; declare class Template { readonly template: string; constructor(template: string); /** Perform substitution, raising KeyError for missing keys */ substitute(mapping?: Record): string; /** Perform substitution, returning original placeholder for missing keys */ safeSubstitute(mapping?: Record): string; /** Get identifiers in template */ getIdentifiers(): string[]; } /** Capitalize words in string */ declare function capWords(s: string, sep?: string): string; declare const string: { /** * Python str.join() */ join(sep: string, iterable: Iterable): string; /** * Python str.split() */ split(s: string, sep?: string, maxsplit?: number): string[]; /** * Python str.rSplit() */ rSplit(s: string, sep?: string, maxsplit?: number): string[]; /** * Python str.strip() */ strip(s: string, chars?: string): string; /** * Python str.lStrip() */ lStrip(s: string, chars?: string): string; /** * Python str.rStrip() */ rStrip(s: string, chars?: string): string; /** * Python str.upper() */ upper(s: string): string; /** * Python str.lower() */ lower(s: string): string; /** * Python str.capitalize() */ capitalize(s: string): string; /** * Python str.title() */ title(s: string): string; /** * Python str.swapCase() */ swapCase(s: string): string; /** * Python str.startsWith() */ startsWith(s: string, prefix: string, start?: number, end?: number): boolean; /** * Python str.endsWith() */ endsWith(s: string, suffix: string, start?: number, end?: number): boolean; /** * Python str.find() */ find(s: string, sub: string, start?: number, end?: number): number; /** * Python str.rFind() */ rFind(s: string, sub: string, start?: number, end?: number): number; /** * Python str.index() - raises error if not found */ index(s: string, sub: string, start?: number, end?: number): number; /** * Python str.rIndex() - raises error if not found */ rIndex(s: string, sub: string, start?: number, end?: number): number; /** * Python str.count() */ count(s: string, sub: string, start?: number, end?: number): number; /** * Python str.replace() */ replace(s: string, old: string, newStr: string, count?: number): string; /** * Python str.zFill() */ zFill(s: string, width: number): string; /** * Python str.center() */ center(s: string, width: number, fillchar?: string): string; /** * Python str.lJust() */ lJust(s: string, width: number, fillchar?: string): string; /** * Python str.rJust() */ rJust(s: string, width: number, fillchar?: string): string; /** * Python str.partition() */ partition(s: string, sep: string): [string, string, string]; /** * Python str.rPartition() */ rPartition(s: string, sep: string): [string, string, string]; /** * Python str.isAlpha() */ isAlpha(s: string): boolean; /** * Python str.isDigit() */ isDigit(s: string): boolean; /** * Python str.isAlnum() */ isAlnum(s: string): boolean; /** * Python str.isSpace() */ isSpace(s: string): boolean; /** * Python str.isUpper() */ isUpper(s: string): boolean; /** * Python str.isLower() */ isLower(s: string): boolean; /** * Python str.format() - basic implementation */ format(s: string, ...args: unknown[]): string; }; export { Template, asciiLetters, asciiLowercase, asciiUppercase, capWords, digits, hexDigits, octDigits, printable, punctuation, string, whitespace };