C++ strings and strchr()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Default User

    #31
    Re: C++ strings and strchr()

    ataru@nospam.cy berspace.org wrote:[color=blue]
    >
    > Default User <first.last@com pany.com> broke the eternal silence and spoke thus:
    >[color=green]
    > > Nothing built-in. Here's a utility I wrote, it's not equivilent to
    > > strtok() but rather ones like PHP explode():[/color]
    >
    > Explode? Oh, you mean like "get bigger" and not "make pretty exceptions all
    > over the place" ;)[/color]


    Like bust it into pieces.



    Brian Rodenborn

    Comment

    • Default User

      #32
      Re: C++ strings and strchr()

      Mike Wahler wrote:
      [color=blue]
      > I guess I'll throw mine away now. :-) I started to
      > hack one out, which was beginning to look very much
      > like this. :-)[/color]


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



      Brian Rodenborn

      Comment

      • Default User

        #33
        Re: C++ strings and strchr()

        ataru@nospam.cy berspace.org wrote:[color=blue]
        >
        > Default User <first.last@com pany.com> broke the eternal silence and spoke thus:
        >[color=green]
        > > Nothing built-in. Here's a utility I wrote, it's not equivilent to
        > > strtok() but rather ones like PHP explode():[/color]
        >
        > Explode? Oh, you mean like "get bigger" and not "make pretty exceptions all
        > over the place" ;)
        >[color=green]
        > > (code)[/color]
        >
        > Cool, thank you...[/color]


        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

        Comment

        Working...