Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - <b>name:</b> <b>strextract() - extract a string between two delimiters</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Name:     strextract() - extract a string between two delimiters
  Usage:    <string> = strextract(<string>,<delims>,<occurrence>)
  Params:   string <string> - the string to scan
            string <delims> - the delimiter character(s) to hunt for
            integer <occurrence> - the occurrence number to return
  Returns:  a string equal to the string between the delimiters at
            occurrence number <occurrence>, or null if space between
            the delimiters is of len(0).

            You can use either a pair of delimiters, or a single
            delimiter. With a single delimiter like a comma, every
            comma counts as a delimiter to a new string whereas
            with a pair of delimiters like two quotes (""), every
            PAIR of delimiters counts as a delimiter to a new string.
            The beginning and end of the string count as a delimiter
            unless a pair of delimiters is passed and the left
            delimiter appears as the FIRST character, or the second
            delimiter appears as the LAST character.

 ---------------------------------- Example ---------------------------------

                 * single delimiter example:
                 memvar = "Mark,Neidorff,Genius"
                 ? strextract(memvar,",",2)
                 * prints Neidorff

                 memvar = ["Mark"Neidorff"Genius"]
                 ? strextract(memvar,["],2)
                 * prints Mark because its not a pair of delimiters
                 * and the delimiter character appears as the
                 * first character.

 ---------------------------------- Example ---------------------------------

                 * pair of delimiters example:
                 memvar = ["Mark","Neidorff","Genius"]
                 ? strextract(memvar,[""],2)
                 * prints Neidorff, not Mark, notice how the
                 * pair of delimiters is counted by twos


See Also: strcenter() ljust() rjust() strexpand() center()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson