Package Bio :: Module stringfns
[show private | hide private]
[frames | no frames]

Module Bio.stringfns

This provides useful general functions for working with strings.

Functions: splitany Split a string using many delimiters. find_anychar Find one of a list of characters in a string. rfind_anychar Find one of a list of characters in a string, from end to start. starts_with Check whether a string starts with another string.
Function Summary
  find_anychar(string, chars, index, negate)
find_anychar(string, chars[, index]) -> index of a character or -1
  rfind_anychar(string, chars, index, negate)
rfind_anychar(string, chars[, index]) -> index of a character or -1
  splitany(s, sep, maxsplit, negate)
splitany(s [,sep [,maxsplit [,negate]]]) -> list of strings
  starts_with(s, start)
starts_with(s, start) -> 1/0

Function Details

find_anychar(string, chars, index=None, negate=0)

find_anychar(string, chars[, index]) -> index of a character or -1

Find a character in string. chars is a list of characters to look for. Return the index of the first occurrence of any of the characters, or -1 if not found. index is the index where the search should start. By default, I search from the beginning of the string.

rfind_anychar(string, chars, index=None, negate=0)

rfind_anychar(string, chars[, index]) -> index of a character or -1

Find a character in string, looking from the end to the start. chars is a list of characters to look for. Return the index of the first occurrence of any of the characters, or -1 if not found. index is the index where the search should start. By default, I search from the end of the string.

splitany(s, sep=' \t\n\x0b\x0c\r', maxsplit=None, negate=0)

splitany(s [,sep [,maxsplit [,negate]]]) -> list of strings

Split a string. Similar to string.split, except that this considers any one of the characters in sep to be a delimiter. If negate is true, then everything but sep will be a separator.

starts_with(s, start)

starts_with(s, start) -> 1/0

Return whether s begins with start.

Generated by Epydoc 2.1 on Wed Jan 31 09:58:01 2007 http://epydoc.sf.net