Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

std::string Question

24 views
Skip to first unread message

MikeCopeland

unread,
Jul 14, 2016, 11:43:43 PM7/14/16
to
Given:

std::string s1 = "Brown, III, Fred B.";

I need to (1) determine that there are 2 commas in this string and (2)
remove the first comma from the string so that it contains
"Brown III, Fred B.".
Presently, I parse the CSV elements into a vector, determine that
there are 3 elements, and rebuild the string without the first comma.
Much work and overhead for what I think this problem needs. 8<{{
I'm seeking some other way(s) to do this, perhaps using string::find
or something. However, there's no "find_next_of" in the STL, so this
doesn't work. Please advise. TIA


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Richard

unread,
Jul 14, 2016, 11:55:23 PM7/14/16
to
[Please do not mail me a copy of your followup]

MikeCopeland <mrc...@cox.net> spake the secret code
<MPG.31f209c76...@news.eternal-september.org> thusly:

>or something. However, there's no "find_next_of" in the STL, so this
>doesn't work. Please advise. TIA

find_first_of has an overload that takes the starting position of the
search.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
0 new messages