CSplitpath:GetFilenameExt


The GetFilenameExt method returns the filename+extension from a CSplitpath object. The returned string has a form like "filename.ext". If the filename has no extension, it is returned without a terminating period.

Syntax

sNameExt = CSplitpath:GetFilenameExt()

 

bullet.gif    On success, this method returns a string containing the filename and extension.

bullet.gif    On failure, this method returns nil.

Example

Suppose a file exists with a full path named sPath. The following script retrieves the filename and extension components:

S = new_splitpath()

-- create a CSplitpath object

S:SetPath(sPath)

-- Specify the path to be split

sNameExt = S:GetFilenameExt()

-- assigns the filename + extension to sNameExt.

S:delete()

-- when done with S, remove it from memory

Related Topics

CSplitpath class


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.