Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, what I am looking for is processing a string value like: "0**" and need for an output string list that contain all the values that matches the input value but only with digits.
In example:
Input: "0**"

Output: (a string list)

"001"
"002"
.
.
.
"010"
"011"
.
.
.
"098"
"099"

I don't know if STL library has already something that can be useful for this purpose.

Thanks.

Regards
Posted

1 solution

 
Share this answer
 
Comments
Demian Panello 12-Mar-13 7:34am    
Hi.
Of course I could iterate trough the input string and start to figure which values matches that criteria and adding to a vector. But what I'm loooking for is something that made this for me. :)
I though that STL probably has a string member function or a helper object to do that, or a known algorithm: getting an input string like "0**" (with wildcards) and returning a string list with all the values that match that criteria.
Is always better something known, (and surely well done) that something from the scratch that probably will need rework.
Thanks.
Sergey Alexandrovich Kryukov 12-Mar-13 11:18am    
This is the whole point. Software development is software development, not finding and using things.

Not only your specific ad-hoc requirement is not implemented in standard libraries, it is not implemented for a very good reason: it would not make sense. Why contaminating a library with ad-hoc stuff? You would be the first to complain that the library is dirty, hard to find something useful. Do you see the point.

What you have is really a solution; and what you have to do should be so compact and robust that there is nothing to discuss, I think.

—SA
Demian Panello 12-Mar-13 12:24pm    
Sorry, you misunderstood what I asked for.
Software developement is also do not reinvent the wheel all the time.
I'm looking for something already developed and well tested about parsing an input string to get new string values that matches that criteria. That is a kind a regular expression, (what I don't know, and I'm asking for, are the bases to this regular expression to acomplish a requirement like this).
I know how to do these things from the scratch, but I will be happy (and my boss too) if I can implement something already known that speed up the developement process. And, that's the purpose of site like this one.
You could say probably: "Something I needed to do something similar and I've implemented..." or "yes, if use the XXX method of the string object at STL...:", or something like that.
Points of directions is what I'm looking for.
Thanks
Sergey Alexandrovich Kryukov 12-Mar-13 12:28pm    
There is no the method you need, because having such method would not make sense, it's way too trivial and ad-hoc.
What do you think I misunderstood?

Your considerations are pretty much irrelevant: you "boss" could probably hire a person who can solve the problem using less time then all this discussion. Therefore, if you want to be such person, not someone else, do the job, and you will see how easy it is. If not, no libraries would help you. I really think you can do it faster than all of your search.

—SA
Demian Panello 12-Mar-13 14:16pm    
Ok Sergey.
Thank you much for your time anyway

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900