Parse path, file or extension from a string
By: Gordon F. MacLeod Date: 01/11/1997
File:

parsepath.zip

Size:

505 bytes

Download now!

This set of three functions will allow you to extract the path, file name or extension from a string.

Syntax

ParsePath(pathstring)
ParseFileName(pathstring)
GetFileExt(pathstring)

Parameters

pathstring: a string containing a complete path and file name

Type of data

String

Returns

Depending on the function: path, file name, file ext.

-

Examples:

p = ParsePath("C:\Work\MyFile.Txt")	p will contain C:\Work
p = ParseFileName("C:\Work\MyFile.Txt") p will contain MyFile
p = GetFileExt("C:\Work\MyFile.Txt")	p will contain Txt

The functions are contained in a module. You can cut and paste them in any program of yours.

Click Here!


Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
Webmaster's e-mail: webmaster@vbprogzone.cjb.net
Hosted by InWind: www.inwind.it