Module stringmod

Module stringmod 

Source
Expand description

Additional string manipulation helpers. Additional Pan string utilities.

Functionsยง

applescriptstring
Escapes a string to use as an AppleScript string literal.
batchreplace
Performs replacements based on a separator-delimited mapping table.
connect
Concatenates prefix and suffix with connector when both exist.
crtovtab
Replaces carriage returns with vertical tabs.
defaulttext
Returns default when text is empty.
extract
Extracts the item-th element from an array.
fixedwidth
Pads or truncates text to exactly width characters.
fixedwidthright
Right-aligns text to width, truncating from the left if needed.
linestrip
Removes empty lines and normalizes line breaks to \n.
lower
Converts all characters to lowercase.
obscuredigits
Replaces all but the last keep_last digits with X.
onespace
Collapses runs of spaces into a single space and trims ends.
onewhitespace
Collapses runs of whitespace into a single space and trims ends.
padzero
quoted
Wraps text in double quotes, doubling any internal quotes.
randomletter
Returns a random ASCII letter.
randomline
Returns a random non-empty line from text.
randomword
Returns a random whitespace-delimited word from wordlist.
rep
Repeats text count times.
replace
Replaces all occurrences of search with replace_with.
replacemultiple
Replaces multiple search strings with their corresponding replacements.
sandwich
Wraps root with prefix and suffix when root is non-empty.
strip
Trims whitespace and control characters from both ends.
stripchar
Keeps only characters within the inclusive range pairs.
striphtmltags
Removes simple HTML tags delimited by < and >.
stripprintable
Removes non-printable ASCII control characters.
striptoalpha
Keeps only alphabetic characters.
striptonum
Keeps only ASCII digits.
upper
Converts all characters to uppercase.
upperword
Uppercases the first character of each whitespace-delimited word.
vtabtocr
Replaces vertical tabs with carriage returns.
yoke
Like connect, but with different parameter naming.