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