src/pylib/Lib/string

Source   Edit  

Consts

ascii_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Source   Edit  
ascii_lowercase = "abcdefghijklmnopqrstuvwxyz"
Source   Edit  
ascii_uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Source   Edit  
digits = "0123456789"
Source   Edit  
hexdigits = "0123456789abcdefABCDEF"
Source   Edit  
octdigits = "01234567"
Source   Edit  
printable = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&\\\'()*+,-./:;<=>?@[\\\\]^_`{|}~ \t\n\r\v\f"
Source   Edit  
punctuation = """!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~"""
Source   Edit  
whitespace = " \t\n\r\v\f"
Source   Edit  

Procs

func capwords(a: StringLike): PyStr

Mimics Python string.capwords(s) -> str:

Runs of whitespace characters are replaced by a single space and leading and trailing whitespace are removed.

Source   Edit  
proc capwords(a: StringLike; _: NoneType): PyStr
Source   Edit  
func capwords(a: StringLike; sep: StringLike): PyStr

Mimics Python string.capwords(s, sep) -> str:

Split the argument into words using split, capitalize each word using capitalize, and join the capitalized words using join. sep is used to split and join the words.

Source   Edit  
proc get_identifiers(templ: Template): PyList[PyStr] {....raises: [Exception],
    tags: [RootEffect], forbids: [].}
Admonition: since Python 3.11
Source   Edit  
proc is_valid(templ: Template): bool {....raises: [Exception], tags: [RootEffect],
                                       forbids: [].}
Admonition: since Python 3.11
Source   Edit  

Macros

macro safe_substitute(templ: Template; kws: varargs[untyped]): PyStr
Source   Edit  
macro safe_substitute(templ: Template; mapping: Mapping; kws: varargs[untyped]): PyStr
Source   Edit  
macro substitute(templ: Template; kws: varargs[untyped]): PyStr
Source   Edit  
macro substitute(templ: Template; mapping: Mapping; kws: varargs[untyped]): PyStr
Source   Edit