Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting rid of a piece of string

Status
Not open for further replies.

Jacquesvdz

Programmer
Jul 2, 2003
9
0
0
ZA
I open a vbg file as text then I retrieve all the vbp.
But I don't want the "VBGROUP 5.0", "StartupProject" and "Project="
How do I do that.

And if I have the "Project=" gone how do I get the full path.




VBGROUP 5.0
StartupProject=HorizonAccPac.vbp
Project=BSHorizonAccPacDLL.vbp
Project=..\HorizonFramework\HorizonSharedTools.vbp
Project=..\HorizonFramework\HorizonFees.vbp
Project=..\HorizonFramework\HorizonInvestments.vbp
Project=..\HorizonFramework\HorizonParties.vbp
Project=..\HorizonDBAccess\HorizonDBAccess.vbp
Project=..\HorizonFramework\HorizonCompliance.vbp
 
If you are reading the file a line at a time, simply ignore the lines that you don't want:

Do While Not EOF(FileNum%)
Line Input #FileNum%, n$
Key$ = Left$(n$, Instr(n$ & "=", "=") -1)
If (Key$ <> &quot;VBGROUP 5.0&quot;) and (Key$ <> &quot;StartupProject&quot;) Then
Keep$ = Keep$ & n$ & vbCRLF
End If
Loop

Keep$ now holds the file without the bits that you don't want.


- Andy
_______________________________
&quot;On a clear disk you can seek forever&quot;
 
Thanks very much.
Maybe you are right, but I just want to get rid of the whole line &quot;VBGROUP 5.0&quot;


and the rest like &quot;StartupProject=&quot; and &quot;Project=&quot;
I want to keep the url after that.

EXample.

VBGROUP 5.0
StartupProject=HorizonAccPac.vbp
Project=BSHorizonAccPacDLL.vbp
Project=..\HorizonFramework\HorizonSharedTools.vbp

Must turn out like this

HorizonAccPac.vbp
BSHorizonAccPacDLL.vbp
..\HorizonFramework\HorizonSharedTools.vbp

 
Try looking up the Instr, Mid and Left functions in VBHelp. You will get everyting you need from there. It's often better for your ongoing development to do some of your own research than to have a fully written answer given.


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Hi,

Since the length are the same, you can try to ignore the first few chars which you don't want
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top