The base presupposition of this class usage is: "ALL strings in
the application are either of utf-8 or unicode type, even when simple str
type is used. UTF-8 is only a "packed" version of unicode, so
Utf-8 and unicode strings are interchangeable."
CAUTION! This class is slower than str/unicode! Do NOT use it inside
intensive loops. Simply decode string(s) to unicode before loop and
encode it back to utf-8 string(s) after intensive calculation.
|
__repr__(self)
# note that we use raw strings to avoid having to use double back
slashes below NOTE! This function is a clone of
web2py:gluon.languages.utf_repl() function |
source code
|
|
|
__size__(self)
length of utf-8 string in bytes |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string
|
|
string
|
|
string
|
|
string
|
|
string
|
|
int
|
index(self,
string)
Like S.find() but raise ValueError when the substring is not found. |
source code
|
|
bool
|
isalnum(self)
Return True if all characters in S are alphanumeric and there is at
least one character in S, False otherwise. |
source code
|
|
bool
|
isalpha(self)
Return True if all characters in S are alphabetic and there is at
least one character in S, False otherwise. |
source code
|
|
bool
|
isdigit(self)
Return True if all characters in S are digits and there is at least
one character in S, False otherwise. |
source code
|
|
bool
|
islower(self)
Return True if all cased characters in S are lowercase and there is
at least one cased character in S, False otherwise. |
source code
|
|
bool
|
isspace(self)
Return True if all characters in S are whitespace and there is at
least one character in S, False otherwise. |
source code
|
|
bool
|
istitle(self)
Return True if S is a titlecased string and there is at least one
character in S, i.e. |
source code
|
|
bool
|
isupper(self)
Return True if all cased characters in S are uppercase and there is
at least one cased character in S, False otherwise. |
source code
|
|
string
|
zfill(self,
length)
Pad a numeric string S with zeros on the left, to fill a field of the
specified width. |
source code
|
|
string
|
join(self,
iter)
Return a string which is the concatenation of the strings in the
iterable. |
source code
|
|
string or unicode
|
lstrip(self,
chars=None)
Return a copy of the string S with leading whitespace removed. |
source code
|
|
string or unicode
|
rstrip(self,
chars=None)
Return a copy of the string S with trailing whitespace removed. |
source code
|
|
string or unicode
|
strip(self,
chars=None)
Return a copy of the string S with leading and trailing whitespace
removed. |
source code
|
|
string
|
swapcase(self)
Return a copy of the string S with uppercase characters converted to
lowercase and vice versa. |
source code
|
|
int
|
count(self,
sub,
start=0,
end=None)
Return the number of non-overlapping occurrences of substring sub in
string S[start:end]. |
source code
|
|
object
|
decode(self,
encoding=' utf-8 ' ,
errors=' strict ' )
Decodes S using the codec registered for encoding. |
source code
|
|
object
|
encode(self,
encoding,
errors=' strict ' )
Encodes S using the codec registered for encoding. |
source code
|
|
string
|
expandtabs(self,
tabsize=8)
Return a copy of S where all tab characters are expanded using
spaces. |
source code
|
|
int
|
find(self,
sub,
start=None,
end=None)
Return the lowest index in S where substring sub is found, such that
sub is contained within S[start:end]. |
source code
|
|
string
|
ljust(self,
width,
fillchar=' ' )
Return S left-justified in a string of length width. |
source code
|
|
(head, sep, tail)
|
partition(self,
sep)
Search for the separator sep in S, and return the part before it, the
separator itself, and the part after it. |
source code
|
|
string
|
replace(self,
old,
new,
count=-1)
Return a copy of string S with all occurrences of substring old
replaced by new. |
source code
|
|
int
|
rfind(self,
sub,
start=None,
end=None)
Return the highest index in S where substring sub is found, such that
sub is contained within S[start:end]. |
source code
|
|
int
|
rindex(self,
string)
Like S.rfind() but raise ValueError when the substring is not found. |
source code
|
|
string
|
rjust(self,
width,
fillchar=' ' )
Return S right-justified in a string of length width. |
source code
|
|
(head, sep, tail)
|
rpartition(self,
sep)
Search for the separator sep in S, starting at the end of S, and
return the part before it, the separator itself, and the part after
it. |
source code
|
|
list of strings
|
rsplit(self,
sep=None,
maxsplit=-1)
Return a list of the words in the string S, using sep as the
delimiter string, starting at the end of the string and working to
the front. |
source code
|
|
list of strings
|
split(self,
sep=None,
maxsplit=-1)
Return a list of the words in the string S, using sep as the
delimiter string. |
source code
|
|
list of strings
|
splitlines(self,
keepends=False)
Return a list of the lines in S, breaking at line boundaries. |
source code
|
|
bool
|
startswith(self,
prefix,
start=0,
end=None)
Return True if S starts with the specified prefix, False otherwise. |
source code
|
|
string
|
translate(self,
table,
deletechars='
' )
Return a copy of the string S, where all characters occurring in the
optional argument deletechars are removed, and the remaining
characters have been mapped through the given translation table,
which must be a string of length 256 or None. |
source code
|
|
bool
|
endswith(self,
prefix,
start=0,
end=None)
Return True if S ends with the specified suffix, False otherwise. |
source code
|
|
string
|
format(self,
*args,
**kwargs)
Return a formatted version of S, using substitutions from args and
kwargs. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
Inherited from str :
__format__ ,
__getattribute__ ,
__getnewargs__ ,
__hash__ ,
__rmod__ ,
__rmul__ ,
__sizeof__ ,
__str__
Inherited from str (private):
_formatter_field_name_split ,
_formatter_parser
Inherited from object :
__delattr__ ,
__init__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__ ,
__subclasshook__
|