class documentation

class FoldedCase(str): (source)

View In Hierarchy

A case insensitive string class; behaves just like str except compares equal when the only variation is case. >>> s = FoldedCase('hello world') >>> s == 'Hello World' True >>> 'Hello World' == s True >>> s != 'Hello World' False >>> s.index('O') 4 >>> s.split('O') ['hell', ' w', 'rld'] >>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta'])) ['alpha', 'Beta', 'GAMMA'] Sequence membership is straightforward. >>> "Hello World" in [s] True >>> s in ["Hello World"] True You may test for set inclusion, but candidate and elements must both be folded. >>> FoldedCase("Hello World") in {s} True >>> s in {FoldedCase("Hello World")} True String inclusion works as long as the FoldedCase object is on the right. >>> "hello" in FoldedCase("Hello World") True But not if the FoldedCase object is on the left: >>> FoldedCase('hello') in 'Hello World' False In that case, use ``in_``: >>> FoldedCase('hello').in_('Hello World') True >>> FoldedCase('hello') > FoldedCase('Hello') False

Method __contains__ Undocumented
Method __eq__ Undocumented
Method __gt__ Undocumented
Method __hash__ Undocumented
Method __lt__ Undocumented
Method __ne__ Undocumented
Method in_ Does self appear in other?
Method index Undocumented
Method lower Undocumented
Method split Undocumented
def __contains__(self, other): (source)

Undocumented

def __eq__(self, other): (source)

Undocumented

def __gt__(self, other): (source)

Undocumented

def __hash__(self): (source)

Undocumented

def __lt__(self, other): (source)

Undocumented

def __ne__(self, other): (source)

Undocumented

def in_(self, other): (source)

Does self appear in other?

def index(self, sub): (source)

Undocumented

@method_cache
def lower(self): (source)

Undocumented

def split(self, splitter=' ', maxsplit=0): (source)

Undocumented