Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > C++ strings and strchr()

Reply
Thread Tools

C++ strings and strchr()

 
 
Default User
Guest
Posts: n/a
 
      08-22-2003
Mike Wahler wrote:

> I guess I'll throw mine away now. I started to
> hack one out, which was beginning to look very much
> like this.



I had a project last year that required parsing long strings (flight
plans) with nested delimiters, first "\r\n", then "..", then ":",
finally ",".



Brian Rodenborn
 
Reply With Quote
 
 
 
 
Default User
Guest
Posts: n/a
 
      08-22-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
>
> Default User <(E-Mail Removed)> broke the eternal silence and spoke thus:
>
> > Nothing built-in. Here's a utility I wrote, it's not equivilent to
> > strtok() but rather ones like PHP explode():

>
> Explode? Oh, you mean like "get bigger" and not "make pretty exceptions all
> over the place"



Like bust it into pieces.



Brian Rodenborn
 
Reply With Quote
 
 
 
 
Default User
Guest
Posts: n/a
 
      08-22-2003
(E-Mail Removed) wrote:
>
> Default User <(E-Mail Removed)> broke the eternal silence and spoke thus:
>
> > Nothing built-in. Here's a utility I wrote, it's not equivilent to
> > strtok() but rather ones like PHP explode():

>
> Explode? Oh, you mean like "get bigger" and not "make pretty exceptions all
> over the place"
>
> > (code)

>
> Cool, thank you...



One major difference between that code and strtok() (besides string
separators vs. character delimiters) is the behavior with adjacent
delimiters.

Example, the string "one,two,,three" gives the tokens:

one
two
three

When using strtok().

And:

one
two

three

With the Explode() routine. That's by design and desire, so that "empty"
fields are represented, not just ignored.



Brian Rodenborn
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Strings, Strings and Damned Strings Ben C Programming 14 06-24-2006 05:09 AM
How to generate k+1 length strings from a list of k length strings? Girish Sahani Python 17 06-09-2006 11:01 AM
Catching std::strings and c-style strings at once Kurt Krueckeberg C++ 2 11-17-2004 03:53 AM
convert list of strings to set of regexes; convert list of strings to trie Klaus Neuner Python 7 07-26-2004 07:25 AM
Comparing strings from within strings Rick C Programming 3 10-21-2003 09:10 AM



Advertisments