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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing characters from the Right of a String 2

Status
Not open for further replies.

JamesBBB

Technical User
Nov 2, 2005
74
GB
Hi

I am sorry to ask such a mundane question, I have tried searching through TEK-TIPS to see if it had been mentioned before but I couldnt find anything.

Basically I have stripped off a load of filenames into a 1 field table and then read each field using openfile within a piece of code.

All thats fine, but I only want to display the name of the file without the extension, so basically I want to remove the last 4 characters of a string. I have tried Left$, right$ and Mid$ but am getting nowhere.

If someone could give me an example on how to do this, I would be extremely grateful.

Many thanks

James
 
How about:

[tt]Mid(strFile,1,InstrRev(strFile,".")-1)[/tt]
 



Hi,

Also the Split funmction
Code:
sFileName = Split(strFile, ".")(0)
sExt = Split(strFile, ".")(1)


Skip,

[glasses] [red][/red]
[tongue]
 
Thanks Guys

Very Much Appreciated

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top