Types
Template = distinct string
-
Hint: Currently inheriting Template is not supported. (In Python, you can custom formatting via defining subclass of Template and overwrite some attributes).Warning:Source Edit
Currently substitute is implemented via % in std/strutils, in which there are two different behaviors from Python's Template:
1. the variables are compared with cmpIgnoreStyle, whereas in Python they are compared in 'ignorecase' flag by default.
2. digit or # following the dollar (e.g. $1) is allowed, and will be substituted by variable at such position, whereas in Python such will cause ValueError.
3. for unknown key, substitute raises ValueError instead of KeyError currently.
Consts
ascii_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
- Source Edit
ascii_lowercase = "abcdefghijklmnopqrstuvwxyz"
- Source Edit
ascii_uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- 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 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 func substitute(templ: Template): PyStr {....raises: [], tags: [], forbids: [].}
- Source Edit