|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
hi,
Please tell me what the below mentined code is doing? If i pass String s as my name is "xyz. and " i am writing . what should be the output. Thanks in advance void parse(Block<String>& f, String s) { int inquote = 0; int nf = 0; int start = -1; for(int i = 0; i <= length(s); i++){ if(i == length(s) || (isspace(s[i]) && !inquote) || (s[i] == '"' && inquote)){ if(start != -1){ nf++; f.reserve(nf); if(inquote && i != length(s)) f[nf-1] = s(start,i-start+1); else f[nf-1] = s(start,i-start); start = -1; inquote = 0; } } else if(start == -1){ start = i; inquote = (s[i] == '"'); } } f.size(nf); } Amit |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
amit129 <rockiecool129@gmail.com> wrote:
> Please tell me what the below mentined code is doing? If i pass String > s as my name is "xyz. and " i am writing . what should be the output. > void parse(Block<String>& f, String s) Why don't you put it into a simple program and just test what it does? Moreover, you picked the wrong newsgroup, this one is for C, not C++. The experts for C++ are on the other side of the hallway in comp.lang.c++. Regards, Jens -- \ Jens Thoms Toerring ___ jt@toerring.de \__________________________ http://toerring.de |
|
![]() |
| Outils de la discussion | |
|
|