Extract one or more components from a path.


NewPath = SRP_Path("GetComponents", Path, Occurrence, Count)


PathA path with or without command line parameters.
OccurrenceThe first component you wish to extract.
CountThe number of components including the first one you wish to extract.


The components returned as a partial path.


The GetComponents service extracts segments of a path much like the way the Field method extracts delimited elements from a string. A component is any path segment delimited by a backslash. Just like the Field method, you choose which component to start with using the Occurrence parameter, then you specify how many components to extract in total. All the components will be returned delimited by backslashes.

Note. This method supports paths that contain command line parameters. In this case, command line parameters are simply ignored and never will be returned.


Path = "C:\path1\path2\path3\filename.txt"
Result1 = SRP_Path("GetComponents", Path, 2, 3)
Result2 = SRP_Path("GetComponents", Path, 5, 3)

Result1 will be "path1\path2\path3". Result2 will be "filename.txt".

See Also

GetDirectory, GetExtension, GetFilename, GetParameters, GetPath

  • No labels