Re: Splitting strings....
Re: Splitting strings....
- Subject: Re: Splitting strings....
- From: Allan Odgaard <email@hidden>
- Date: Sat, 28 Feb 2004 18:06:27 +0100
On 28. Feb 2004, at 17:32, Allan Odgaard wrote:
Also a string can contain a quote character if it is doubled...
Did you make up this latter rule yourself? It complicates things [...]
unichar* skip_string (unichar* first, unichar* last)
{
bool escape = false;
for(++first; first != last; ++first)
{
if(!escape && *first == '\'')
break;
escape = !escape && *first == '\\';
}
}
Actually, it doesn't complicate things, and the above was broken in
that it forgot to increment first and return it, using the original
rule it would be:
unichar* skip_string (unichar* cur, unichar* last)
{
bool prevIsQuote = false;
for(++cur; cur != last; ++cur)
{
if(prevIsQuote && *cur != '\'')
break;
prevIsQuote = !prevIsQuote && *cur == '\'';
}
return cur;
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.