Boost logo

Boost :

From: John Maddock (jm_at_[hidden])
Date: 2002-11-23 07:46:56


Alexei,

Looks like we're all thinking alike, a while ago I put together a sequence
based substring class that could act as a universal wrapper for any string
like object, along with a set of algorithms to act upon it: it's based
loosely on Darin Adler's original string algorithm code.

classes:

string_traits: this is the glue that allows the classes and algorithms to
act upon any string like object (std::string, char*, other string classes
etc)
basic_substring: an immutable view of any string like object (or iterator
sequence).

Algorithms returning a substring:

rtrim
ltrim
trim

Algorithms returning a new string:

make_upper
make_lower

Inplace transformations:

inplace_ltrim
inplace_rtrim
inplace_trim
inplace_make_upper
inplace_make_lower

And then I ran out of time... :-)

I've put what I have at
http://groups.yahoo.com/group/boost/files/string_algorithm/substring.zip,
it's actually pretty complete with full test cases etc, but I'm not sure
where this would fit in with the proposed new string lib, plus I'm pretty
short of time at present. Still I'm hoping someone can make use of this and
maybe the new string lib can include a synthesis of all these ideas...

John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk