HOME - Recent Changes - Search:

Academic Work


Personal

* pot de départ


dblp


(:twitter:)

-----

[ edit | logout ]
[ help | sandbox | passwd ]

String functions

#############################

See also http://docs.python.org/library/stdtypes.html#string-methods .

capitalizeS.capitalize() → string Return a copy of the string S with only its first character capitalized.
centerS.center(width[, fillchar]) → string Return S centered in a string of length width. Padding is done using the specified fill character (default is a space)
countS.count(sub[, start[, end]]) → int Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
decodeS.decode([encoding[,errors]]) → object Decodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is 'strict' meaning that encoding errors raise a UnicodeDecodeError. Other possible values are 'ignore' and 'replace' as well as any other name registered with codecs.register_error that is able to handle UnicodeDecodeErrors.
encodeS.encode([encoding[,errors]]) → object Encodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is 'strict' meaning that encoding errors raise a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and 'xmlcharrefreplace' as well as any other name registered with codecs.register_error that is able to handle UnicodeEncodeErrors.
endswithS.endswith(suffix[, start[, end]]) → bool Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.
expandtabsS.expandtabs([tabsize]) → string Return a copy of S where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.
findS.find(sub [,start [,end]]) → int Return the lowest index in S where substring sub is found, such that sub is contained within s[start:end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
formatS.format(*args, **kwargs) → unicode
indexS.index(sub [,start [,end]]) → int Like S.find() but raise ValueError when the substring is not found.
isalnumS.isalnum() → bool Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.
isalphaS.isalpha() → bool Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.
isdigitS.isdigit() → bool Return True if all characters in S are digits and there is at least one character in S, False otherwise.
islowerS.islower() → bool Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.
isspaceS.isspace() → bool Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.
istitleS.istitle() → bool Return True if S is a titlecased string and there is at least one character in S, i.e. uppercase characters may only follow uncased characters and lowercase characters only cased ones. Return False otherwise.
isupperS.isupper() → bool Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.
joinS.join(sequence) → string Return a string which is the concatenation of the strings in the sequence. The separator between elements is S.
ljustS.ljust(width[, fillchar]) → string Return S left-justified in a string of length width. Padding is done using the specified fill character (default is a space).
lowerS.lower() → string Return a copy of the string S converted to lowercase.
lstripS.lstrip([chars]) → string or unicode Return a copy of the string S with leading whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping
partitionS.partition(sep) → (head, sep, tail) Search for the separator sep in S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return S and two empty strings.
replaceS.replace (old, new[, count]) → string Return a copy of string S with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.
rfindS.rfind(sub [,start [,end]]) → int Return the highest index in S where substring sub is found, such that sub is contained within s[start:end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
rindexS.rindex(sub [,start [,end]]) → int Like S.rfind() but raise ValueError when the substring is not found.
rjustS.rjust(width[, fillchar]) → string Return S right-justified in a string of length width. Padding is done using the specified fill character (default is a space)
rpartitionS.rpartition(sep) → (tail, sep, head) 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. If the separator is not found, return two empty strings and S.
rsplitS.rsplit([sep [,maxsplit]]) → list of strings 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. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator.
rstripS.rstrip([chars]) → string or unicode Return a copy of the string S with trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping
splitS.split([sep [,maxsplit]]) → list of strings Return a list of the words in the string S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator and empty strings are removed from the result.
splitlinesS.splitlines([keepends]) → list of strings Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.
startswithS.startswith(prefix[, start[, end]]) → bool Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.
stripS.strip([chars]) → string or unicode Return a copy of the string S with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping
swapcaseS.swapcase() → string Return a copy of the string S with uppercase characters converted to lowercase and vice versa.
titleS.title() → string Return a titlecased version of S, i.e. words start with uppercase characters, all remaining cased characters have lowercase.
translateS.translate(table [,deletechars]) → string 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.
upperS.upper() → string Return a copy of the string S converted to uppercase.
zfillS.zfill(width) → string Pad a numeric string S with zeros on the left, to fill a field of the specified width. The string S is never truncated.
Cloud City


anime | bash | blogs | bsd | c/c++ | c64 | calc | comics | convert | cube | del.icio.us | digg | east | eBooks | egeszseg | elite | firefox | flash | fun | games | gimp | google | groovy | hardware | hit&run | howto | java | javascript | knife | lang | latex | liferay | linux | lovecraft | magyar | maths | movies | music | p2p | perl | pdf | photoshop | php | pmwiki | prog | python | radio | recept | rts | scala | scene | sci-fi | scripting | security | shell | space | súlyos | telephone | torrente | translate | ubuntu | vim | wallpapers | webutils | wikis | windows


Blogs and Dev.

* Ubuntu Incident
* Python Adventures
* me @ GitHub


Places

Debrecen | France | Hungary | Montreal | Nancy


Notes

full circle | km


Hobby Projects

* Jabba's Codes
* PmWiki
* Firefox
* PHP
* JavaScript
* Scriptorium
* Tutorials
* me @ GitHub


Quick Links


[ edit ]

View - Edit - History - Attach - Print *** Report - Recent Changes - Search
Page last modified on 2009 October 20, 22:26