Feature Requests item #1190701, was opened at 2005-04-26 20:35 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1190701&group_id=5470
Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Submitted By: Christopher Dunn (cxdunn) Assigned to: Nobody/Anonymous (nobody) Summary: Add 'before' and 'after' methods to Strings Initial Comment: GNU String used to have two very useful methods, 'before' and 'after'. These are so useful I keep them defined in an __init__.py file. (Unfortunately, I do not know how to make them methods, instead of global functions.) Usage: >>> "root.sub".before(".") 'root' >>> "root.sub1.sub2".after("root.sub1") '.sub2' They work like s.split(word)[0], and s.split(word)[-1], but they are so intuitive they ought to be part of the interface. I'm not sure whether they should raise exceptions on failure, or simply return the whole string. -cxdunn ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1190701&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com