<-- Previous || Up || Next -->

Separate Prefix And Extension Function
File Names Class

Public Function SeparatePrefixAndExtension( _
      ByRef rPathName As Variant _
    , ByRef rExtension As Variant _
    , ByVal vPathName As Variant _
    ) As Boolean

Separate a file name like "C:\WINDOWS\USER.EXE" into its Path ("C:\WINDOWS\USER") and Extension ("EXE") components.
Removes the separator (".") between the Path Name and Extension, if any.
Remove the last path separator "\" unless it immediately follows the drive separator ":".
Function returns True upon success and False upon failure.

    vPathName              rPathName              rExtension
    ---------------------  ---------------------  -------------
    C:\                    C:\
    C:\Temp                C:\Temp
    C:\Temp\Win.Tmp        C:\Temp\Win            Tmp
    \\SJS4\C\Temp\Win.Tmp  \\SJS4\C\Temp\Win      Tmp
    \\SJS4\Entisoft\Tools  \\SJS4\Entisoft\Tools
       Dim strPath As String
       Dim strExt As String
    for example
       SeparatePathAndFile(strPath, strExt, "C:\Temp\Win.Tmp") = True
       strPath = "C:\Temp\Win"
       strExt = "Tmp"
See also:
    SeparateDriveAndPath Function
    SeparatePathAndFile Function
    CombinePrefixAndExtension Function
rPathName: String or Variant that will receive the drive, directory path, and/or file prefix portions of vPathName.
rExtension: String or Variant that will receive the file extension portion of vPathName.
vPathName: The path name that will be separated into its drive/path/prefix and extension portions. If vPathName is Null or cannot be fixed-up to a string, this function sets both rPathName and rExtension to an empty string then returns False.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.