|
-
Jan 22nd, 2013, 10:52 AM
#1
Thread Starter
Junior Member
[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
-
Jan 22nd, 2013, 11:01 AM
#2
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)
-
Jan 22nd, 2013, 11:01 AM
#3
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.
-
Jan 22nd, 2013, 11:06 AM
#4
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|