Path/Key Handling and Manipulation

String Manipulation
Roman Bobik

Version Compatibility: Visual Basic 6

More information:
These functions allow you do manipulate Directory/File Paths or Keys (maybe for TreeView) separated by a backslash "\". The functions are optimized for max. performance and are all written in pure VB.

Following functions are included:

  • getLen: Retrieves the Length (Count of Path-Parts) of the Path
  • getLeft: Retrieves a given count of Path-Parts from a Path of the left side
  • getRight: Retrieves a given count of Path-Parts from a Path of the right side
  • GetParent: Retrieves the Parent-Path of a given Path.
  • TrimPath: Trimms a path to a given count of characters. Path parts are shortened by replacing them with "...".
  • StrCount: Used by GetLen to retrieve the count of a given SubString in a string.
  • GetFileName: Retrieves the filename of a path (with extension or without)
  • MakeEndBackslash: Ensures that a given Path ends with a Backslash.

Instructions: Copy the declarations and code below and paste directly into your VB project.