GetExtensionName Method

 

Description

 

Returns a string containing the extension name for the last component in a path.

 

PowerBASIC Syntax

 

METHOD GetExtensionName ( _

BYVAL bstrPathSpec AS STRING _

) AS STRING

 

Arguments

 

bstrPathSpec

BSTR. The path specification for the component whose extension name is to be returned.

 

Return Value

 

BSTR. The extension name.

 

Remarks

 

For network drives, the root directory (\) is considered to be a component.

 

The GetExtensionName method returns a zero-length string ("") if no component matches the path argument.

 

Example [PowerBASIC]

 

#INCLUDE "windows.inc"

#INCLUDE "scrrun.inc"

 

DIM fso AS IFileSystem

DIM strName AS STRING

 

' Create an instance of the FileSystemObject

fso = NEWCOM "Scripting.FileSystemObject"

' Get the extension name

strName = fso.GetExtensionName(UCODE$("C:\MyFolder\Test.txt"))

 

Valid XHTML 1.0 Transitional