Click here to Skip to main content
15,898,222 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: string in switch case Pin
toxcct1-Aug-05 1:43
toxcct1-Aug-05 1:43 
QuestionHow to add MFC support to an ATL project in Visual C++ Pin
24-Jul-05 17:31
suss24-Jul-05 17:31 
AnswerRe: How to add MFC support to an ATL project in Visual C++ Pin
Member 212103824-Jul-05 18:21
Member 212103824-Jul-05 18:21 
AnswerRe: How to add MFC support to an ATL project in Visual C++ Pin
Stuart Dootson25-Jul-05 21:53
professionalStuart Dootson25-Jul-05 21:53 
GeneralRe: How to add MFC support to an ATL project in Visual C++ Pin
Member 212103825-Jul-05 22:45
Member 212103825-Jul-05 22:45 
Questionhow do you insert socket in WTL? Pin
andy-wang22-Jul-05 16:26
andy-wang22-Jul-05 16:26 
Generalstd::string Pin
LCI21-Jul-05 5:48
LCI21-Jul-05 5:48 
GeneralRe: std::string Pin
Christian Graus21-Jul-05 18:56
protectorChristian Graus21-Jul-05 18:56 
LCI wrote:
So i am using std::string but i have never used this before and am so confused

This is one good reason to prefer the standard library, you'll know it when you need it Smile | :)

What you really need is regex, I wonder if you're able to use the regex implimentation that boost offers ?

Otherwise :

	string s = "xxxcdfdftbvbfggbnghghg Name: Todd Shields ccfgfgnfgnrri DOB:091580 hgertrtreggeegegggggggggggg";<br />
<br />
	size_t n = s.find_first_of("Name : ") + 7; // ( 7 is the length of the string we searched for<br />
	size_t nLast = s.find_first_of(" ", n);<br />
	nLast = s.find_first_of(" ", nLast + 1); // Need to search twice because of the space in the name<br />
<br />
	string name = s.substr(n, nLast - n);


This is REALLY fragile. Ideally, you'd know the string that comes after ( ccfgfgnfgnrri in this case ), so you can search for the item AFTER the name, instead of having to count on there being a certain number of whitespace chars IN the name. The date is obviously easier, but either way, CString wouldn't help much, regex is the real way to deal with this.



Christian Graus - Microsoft MVP - C++
GeneralRe: std::string Pin
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX21-Jul-05 23:46
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX21-Jul-05 23:46 
GeneralRe: std::string Pin
Christian Graus22-Jul-05 11:52
protectorChristian Graus22-Jul-05 11:52 
GeneralRegular Expressions Pin
Kevin McFarlane23-Jul-05 1:17
Kevin McFarlane23-Jul-05 1:17 
GeneralRe: Regular Expressions Pin
Christian Graus23-Jul-05 2:46
protectorChristian Graus23-Jul-05 2:46 
GeneralRe: Regular Expressions Pin
Kevin McFarlane23-Jul-05 3:43
Kevin McFarlane23-Jul-05 3:43 
GeneralRe: Regular Expressions Pin
Christian Graus23-Jul-05 10:58
protectorChristian Graus23-Jul-05 10:58 
GeneralRe: std::string - HELP Pin
LCI25-Jul-05 4:35
LCI25-Jul-05 4:35 
GeneralRe: std::string - HELP Pin
Roland Pibinger25-Jul-05 13:08
Roland Pibinger25-Jul-05 13:08 
GeneralRe: std::string - HELP Pin
Rob Caldecott26-Jul-05 21:08
Rob Caldecott26-Jul-05 21:08 
GeneralRe: std::string - HELP Pin
Kevin McFarlane30-Jul-05 23:38
Kevin McFarlane30-Jul-05 23:38 
GeneralRe: std::string - HELP Pin
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX31-Jul-05 23:46
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX31-Jul-05 23:46 
GeneralRe: std::string - HELP Pin
Kevin McFarlane1-Aug-05 7:21
Kevin McFarlane1-Aug-05 7:21 
GeneralRe: std::string - HELP Pin
Nemanja Trifunovic1-Aug-05 8:12
Nemanja Trifunovic1-Aug-05 8:12 
GeneralRe: std::string - HELP Pin
Kevin McFarlane1-Aug-05 23:04
Kevin McFarlane1-Aug-05 23:04 
GeneralRe: std::string - HELP Pin
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX2-Aug-05 2:19
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX2-Aug-05 2:19 
GeneralRe: std::string Pin
Igor Vigdorchik25-Jul-05 9:27
Igor Vigdorchik25-Jul-05 9:27 
Generalusing auto_ptr Pin
kramkrish21-Jul-05 1:17
kramkrish21-Jul-05 1:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.