Results 1 to 5 of 5

Thread: string split

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2003
    Posts
    124

    Question string split

    I have a string in the following format

    strData = "h:\Folder Name1\FolderName2 Comment About Something"

    I would like to split the h:\Folder Name1\FolderName2" from the
    "Comment About Something"

    Len(strData) >=3

    i would like to split strData into strPath and strComment

    any help would be greatly appreciated

    db

  2. #2
    Junior Member Armor-Of-God's Avatar
    Join Date
    Apr 2003
    Location
    Panic In Detroit
    Posts
    30
    Are there only two folders? If so, you could add another \ at the end of folder 2, and use that as a marker. Then, use the Split function, which I'm not very familiar with.
    Our Way To Fall

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2003
    Posts
    124
    there number of folders is also variable

  4. #4
    Hyperactive Member Stiletto's Avatar
    Join Date
    Aug 2002
    Location
    Jerusalem, Israel
    Posts
    287
    VB Code:
    1. Dim Arr() As String
    2. Arr = Split(strData, " ")
    3. MsgBox Arr(0)
    4. MsgBox Arr(1)
    You can use this, if your folders will have "_" instead of space.
    If you want to keep the space, there are other ways of doing that.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2003
    Posts
    124
    Unfortunately the folder names do contain spaces instead of the _ character.

    Is there a way of splitting only at the first space after the text directly adjacent to the \

    "\Text Split Before the S char"

    Result:

    "\Text"
    "Split Before the S char"

    thx
    db

Posting Permissions

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



Click Here to Expand Forum to Full Width