CSplitpath:SetExt


The SetExt method sets the file extension component of the CSplitpath object. Use Merge to combine this component and the other components into a full path.

Syntax

bSuccess = CSplitpath:SetExt( sExtension )

where

 

    sExtension is the new file extension, without a preceding dot.

    bSuccess is the returned success code. On success it is true, otherwise false.

Example

Suppose a file exists with a full path named sPath. The following script creates a new path using a different file extension named sNewExt:

S = CSplitpath:new( sPath )

-- create a CSplitpath object for path sPath

S:SetExt( "txt" )

-- assign a new file extension

S:Merge()

-- combine the path components

Related Topics

GetExt

CSplitpath class