Results 1 to 4 of 4

Thread: [RESOLVED] Split question

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2013
    Posts
    24

    Resolved [RESOLVED] Split question

    Let's say there is data with one delimiter vbCrlf :

    Code:
    Jack
    Jhon
    James
    George
    it's easy to split this data using code like this:

    Code:
    entry= Split(data, , vbCrLf, vbBinaryCompare)
    But, how i can I split the data that has two delimiters: vbCrlf & Space? Something like this:

    Code:
    010203 Jack
    909090 Jhon
    304050 James
    506070 George
    This example contans "space" and "new line", how can I split them?

    Thanks

  2. #2
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: Split question

    Code:
    Entry = Split(Replace(Data, vbCrLf, " "))
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  3. #3
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Split question

    If you know the format of those first 6 characters, you can use mid() function in conjunction with split.
    Or, you can use the instr() funtion to get everthing before the space. You can also use that to get the vbcr.
    Lots of ways to parse this file.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jan 2013
    Posts
    24

    Re: Split question

    Thanks guys! I thought it was a special function to split in this way without mid and instr Much appreciated!

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