Table of Contents

Module: stringfns Bio/Tools/stringfns.py

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.

Functions   
find_anychar
rfind_anychar
splitany
starts_with
  find_anychar 
find_anychar (
        string,
        chars,
        index=None,
        )

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 
rfind_anychar (
        string,
        chars,
        index=None,
        )

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 
splitany (
        s,
        sep=" \011\012\013\014\015",
        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 
starts_with ( s,  start )

starts_with(s, start) -> 1/0

Return whether s begins with start.

XXX should deprecate. Python 2.0 and above has ''.startswith function.


Table of Contents

This document was automatically generated on Mon Jul 1 12:03:03 2002 by HappyDoc version 2.0.1