🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Eugene Radchenko Fri, 06 Oct 1995 22:05
Safe substringing ?
#2142
Author: Eugene Radchenko
Date: Fri, 06 Oct 1995 22:05
25 lines
1773 bytes
Hi people!
I would like the following to find its way into the standard:
In string template, it would be nice to have the function - say
  basic_string<T> safesstr(size_t start = 0, size_t length = npos) const;
- which would return the (possibly empty) intersection of the target string
and the requested range without throwing the out-of-range exceptions.
It is very useful, f.i., in parsing text files if certain field is not
present.
It is of course easy to write such myself (as I did), but the operation
seems rather common, so everybody will end up writing his own version.

                Cheers                       Genie

--
--------------------------------------------------------------------
Eugene V. Radchenko           Graduate Student in Computer Chemistry
E-mail: eugene@qsar.chem.msu.su                Fax: +7-(095)939-0290 
Ordinary mail:  Chair of Organic Chemistry, Department of Chemistry,
                      Moscow State University, 119899 Moscow, Russia
*****************  Disappearances are deceptive  *******************


[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads