string processing utilities for extracting strings with various kinds
of delimiters
|
find_all(searchin,
substr)
returns a list of locations where substr occurs in searchin locations
are not allowed to overlap |
source code
|
|
|
extract(source,
startdelim,
enddelim,
escape=None,
startinstring=False,
allowreentry=True)
Extracts a doublequote-delimited string from a string, allowing for
backslash-escaping returns tuple of (quoted string with quotes, still
in string at end) |
source code
|
|
|
extractfromlines(lines,
startdelim,
enddelim,
escape)
Calls extract over multiple lines, remembering whether in the string
or not |
source code
|
|
|
extractstr(source)
Extracts a doublequote-delimited string from a string, allowing for
backslash-escaping |
source code
|
|
|
extractcomment(lines)
Extracts <!-- > XML comments from lines |
source code
|
|
|
extractwithoutquotes(source,
startdelim,
enddelim,
escape=None,
startinstring=False,
includeescapes=True,
allowreentry=True)
Extracts a doublequote-delimited string from a string, allowing for
backslash-escaping includeescapes can also be a function that takes
the whole escaped string and returns the replaced version |
source code
|
|
|
escapequotes(source,
escapeescapes=0)
Returns the same string, with double quotes escaped with backslash |
source code
|
|
|
escapesinglequotes(source)
Returns the same string, with single quotes doubled |
source code
|
|
|
|
|
|
|
javapropertiesencode(source)
encodes source in the escaped-unicode encoding used by Java
.properties files |
source code
|
|
|
mozillapropertiesencode(source)
encodes source in the escaped-unicode encoding used by Mozilla
.properties files |
source code
|
|
|
escapecontrols(source)
escape control characters in the given string |
source code
|
|
|
|
|
quotestr(source,
escapeescapes=0)
Returns a doublequote-delimited quoted string, escaping double quotes
with backslash |
source code
|
|
|
singlequotestr(source)
Returns a doublequote-delimited quoted string, escaping single quotes
with themselves |
source code
|
|
|
eitherquotestr(source)
Returns a singlequote- or doublequote-delimited string, depending on
what quotes it contains |
source code
|
|
|
|
|
|
|
stripcomment(comment,
startstring=' <!-- ' ,
endstring=' --> ' ) |
source code
|
|
|
unstripcomment(comment,
startstring=' <!-- ' ,
endstring=' -->\n ' ) |
source code
|
|
|
encodewithdict(unencoded,
encodedict)
encodes certain characters in the string using an encode dictionary |
source code
|
|
|
makeutf8(d)
convert numbers to utf8 codes in the values of a dictionary |
source code
|
|
|
|