• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Splitting strings....
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Splitting strings.... (From: Jerry LeVan <email@hidden>)
 >Re: Splitting strings.... (From: Allan Odgaard <email@hidden>)

  • Prev by Date: Re: how to create status bar?
  • Next by Date: NSSpliteView in Xcode Help UI
  • Previous by thread: Re: Splitting strings....
  • Next by thread: Basic thread example?
  • Index(es):
    • Date
    • Thread