CSplitpath:GetDrive CSplitpath:GetExt2

CSplitpath:GetExt


The GetExt method returns the file extension from a CSplitpath object. The extension is returned with a preceding dot, as in ".fts". To return the path without a preceding dot, use GetExt2().

Syntax

sExt = CSplitpath:GetExt()

 

    On success, this method returns a string containing the file extension.

    On failure, this method returns nil.

Example

Suppose a file exists with a full path named sPath. The following script fragment retrieves the file extension component:

 

S = CSplitpath:new()

-- create a CSplitpath object

S:SetPath(sPath)

-- Specify the path to be split

sExt = S:GetExt()

-- assigns the file extension component to the string sExt.

S:delete()

-- when done with S, remove it from memory

Related Topics

CSplitpath, GetExt2