Class for strings with color markup.
This class provides automatic resolution of color XML markup in
strings for various output formats. It automatically escapes any raw
strings combined with it (e.g. when using the %
or
+
operators) and returns objects of its own type from
methods (e.g. from split()
or strip()
).
Otherwise it should behave like a normal string.
Note that usage of this class is expensive, given that arguments are
constantly checked and strings escaped. It should be used only for
user-visible output, i.e. where human reaction time is the limiting
factor.
|
|
|
|
|
|
|
|
unicode
|
join(self,
strings)
Return a string which is the concatenation of the strings in the
iterable. |
|
|
string
|
resolve(self,
ctype=None,
dest=None)
Resolve color markup according to given type and destination. |
|
|
string, int
|
visual_segment(self,
pos)
Get visual representation of raw segment starting from position. |
|
|
|
|
|
|
|
|
|
|
unicode
|
capitalize(self,
*args,
**kwargs)
Return a capitalized version of S, i.e. |
|
|
unicode
|
center(self,
*args,
**kwargs)
Return S centered in a Unicode string of length width. |
|
|
unicode
|
expandtabs(self,
*args,
**kwargs)
Return a copy of S where all tab characters are expanded using
spaces. |
|
|
int
|
ljust(self,
*args,
**kwargs)
Return S left-justified in a Unicode string of length width. |
|
|
unicode
|
lower(self,
*args,
**kwargs)
Return a copy of the string S converted to lowercase. |
|
|
unicode
|
lstrip(self,
*args,
**kwargs)
Return a copy of the string S with leading whitespace removed. |
|
|
unicode
|
replace(self,
*args,
**kwargs)
Return a copy of S with all occurrences of substring old replaced by
new. |
|
|
unicode
|
rjust(self,
*args,
**kwargs)
Return S right-justified in a Unicode string of length width. |
|
|
list of strings
|
rsplit(self,
*args,
**kwargs)
Return a list of the words in S, using sep as the delimiter string,
starting at the end of the string and working to the front. |
|
|
unicode
|
rstrip(self,
*args,
**kwargs)
Return a copy of the string S with trailing whitespace removed. |
|
|
list of strings
|
split(self,
*args,
**kwargs)
Return a list of the words in S, using sep as the delimiter string. |
|
|
unicode
|
strip(self,
*args,
**kwargs)
Return a copy of the string S with leading and trailing whitespace
removed. |
|
|
unicode
|
swapcase(self,
*args,
**kwargs)
Return a copy of S with uppercase characters converted to lowercase
and vice versa. |
|
|
unicode
|
title(self,
*args,
**kwargs)
Return a titlecased version of S, i.e. |
|
|
unicode
|
translate(self,
*args,
**kwargs)
Return a copy of the string S, where all characters have been mapped
through the given translation table, which must be a mapping of
Unicode ordinals to Unicode ordinals, Unicode strings or None. |
|
|
unicode
|
upper(self,
*args,
**kwargs)
Return a copy of S converted to uppercase. |
|
|
unicode
|
zfill(self,
*args,
**kwargs)
Pad a numeric string S with zeros on the left, to fill a field of the
specified width. |
|
|
Inherited from unicode :
__contains__ ,
__eq__ ,
__format__ ,
__ge__ ,
__getattribute__ ,
__getnewargs__ ,
__gt__ ,
__hash__ ,
__le__ ,
__len__ ,
__lt__ ,
__ne__ ,
__new__ ,
__rmod__ ,
__sizeof__ ,
__str__ ,
count ,
decode ,
encode ,
endswith ,
find ,
format ,
index ,
isalnum ,
isalpha ,
isdecimal ,
isdigit ,
islower ,
isnumeric ,
isspace ,
istitle ,
isupper ,
partition ,
rfind ,
rindex ,
rpartition ,
splitlines ,
startswith
Inherited from object :
__delattr__ ,
__init__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__ ,
__subclasshook__
|