Re: strtok but keep the separator

From: Martin Ambuhl (mambuhl_at_earthlink.net)
Date: 12/01/04


Date: Wed, 01 Dec 2004 13:43:59 -0500

Steven wrote:
> I need a way to use strtok or some other function to parse a string but keep
> the original separator.

Copy the string; keep the original; work on the copy.



Relevant Pages

  • Re: Help With PyParsing of output from win32pdhutil.ShowAllProcesses()
    ... None to a string). ... Still have an urge to parse with pyparsing? ... pyparsing Dict class. ... keys from the parsed data, so it looks like you are already thinking ...
    (comp.lang.python)
  • Re: Does strtok require a non-null token?
    ... In other words, if the string has 2 colons in a row, it ... Just one more reason to avoid strtok(). ... That is, for the majority of the reasons I need to tokenized a string, this default behaviour is exactly what I want. ... For those requirements that strtokdoes not fit we have our own internal tokenizing routines. ...
    (comp.lang.c)
  • Re: strtok ( ) help
    ... > splitCommandssomehow modifying the pointer, but I HAVE to call that ... Here's an idea of how to use the strtok() function. ... don't mind trashing the contents of a string s, ... will give you a loop that extracts the tokens one at a time from s. ...
    (comp.lang.c)
  • Re: Does strtok require a non-null token?
    ... In other words, if the string has 2 colons in a row, it ... Just one more reason to avoid strtok(). ... tokenized a string to store in my own array of buffers, ... But I also think that once you understand the limitations and caveats that go along with it, there is no reason not to use it for those cases where it is a good fit. ...
    (comp.lang.c)
  • Re: Pyparsing help
    ... our grammar isn't parsing the METAL2 entry at all. ... input string". ... successful parse, then restored half of the entries I removed, until I ... Layer PRBOUNDARY ...
    (comp.lang.python)