+ Reply to Thread
Results 1 to 2 of 2

Parse a long string into lines?

  1. #1
    quartz
    Guest

    Parse a long string into lines?

    I have a long string that I need to parse into separate lines. Has anyone got
    a function that will do this neatly? I'm having a devil of a time...

    For example, parse the following:

    This is an example of a string parser that will return only one
    line at a time. The first line ends at "one" in the previous line and
    it is marked by a "vbCr" character. The second line ends at
    "and" and the third line ends at "at".

    The above would return "This is an example of a string parser that will
    return only one" as the first line;

    The second line is "line at a time. The first line ends at "one" in the
    previous line and", etc.

    Each line is marked by a "vbCr" character...thanks in advance.

  2. #2
    Bryan Dickerson
    Guest

    Re: Parse a long string into lines?

    If each line is marked with a "vbCR", then use the split function. It
    produces a dynamic array.

    Dim sArray() as string

    sArray = split("text string goes here", vbCr)

    ' Then sArray(0) = "text up until vbCr"
    ' sArray(1) = "more text until another vbCr"

    "quartz" <[email protected]> wrote in message
    news:[email protected]...
    > I have a long string that I need to parse into separate lines. Has anyone

    got
    > a function that will do this neatly? I'm having a devil of a time...
    >
    > For example, parse the following:
    >
    > This is an example of a string parser that will return only one
    > line at a time. The first line ends at "one" in the previous line and
    > it is marked by a "vbCr" character. The second line ends at
    > "and" and the third line ends at "at".
    >
    > The above would return "This is an example of a string parser that will
    > return only one" as the first line;
    >
    > The second line is "line at a time. The first line ends at "one" in the
    > previous line and", etc.
    >
    > Each line is marked by a "vbCr" character...thanks in advance.




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1