Extracts the file extension, if there is one.

Syntax

Extension = SRP_Path("GetExtension", Path, IncludePeriod)

Parameters

ParameterDescription
PathA path with or without command line parameters.
IncludePeriod1 to include the period, 0 to not include the period.

Returns

The file extension, if there is one.

Remarks

The GetExtension service extracts the file extension. The extension will include a preceding 0 if IncludePeriod is set to 1. Otherwise, the extension is returned without the period.

Note. This method supports paths that contain command line parameters. In this case, command line parameters are simply ignored.

Example

Result1 = SRP_Path("GetExtension", "C:\path\filename.txt", 1)
Result2 = SRP_Path("GetExtension", "C:\path\filename.txt.ext", 0)

Result1 will be ".txt". Result2 will be "ext".

See Also

AddExtension, GetComponents, GetDirectory, GetFilename, GetParameters, GetPath, RemoveExtension, RenameExtension

  • No labels