Article View: comp.std.c++
Article #2142Safe substringing ?
From: Eugene Radchenko
Date: Fri, 06 Oct 1995 22:05
Date: Fri, 06 Oct 1995 22:05
25 lines
1773 bytes
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. ]
Technical Details
Message-ID:
<AD4nJTmKgB@qsar.chem.msu.su>Path:
arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamageShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage From: "Eugene Radchenko" <eugene@qsar.chem.msu.su> Newsgroups: comp.std.c++ Subject: Safe substringing ? Date: 6 Oct 1995 22:05:07 GMT Organization: Lab. of Org.Synth., MSU Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <AD4nJTmKgB@qsar.chem.msu.su> NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text X-Mailer: dMail [Demos Mail for DOS v1.23] Content-Length: 1052 X-Lines: 21 Originator: clamage@taumet