Skip to content

vlt.file.tidypathstring

  TIDYPATHSTRING - clean up a path string, removing any double file separators

  P_STRING_OUT = TIDYPATHSTRING(P_STRING [, FILE_SEPARATOR])

  Removes any double file separators. By default, the local machine
  architecture's FILESEP is used, but the user can pass a different
  FILE_SEPARATOR if desired. Any trailing file separator is also
  removed.

  If the string '://' is found, no text before or including this
  string will be edited.

  If the file separator is '\', then a leading '\\' is also not
  edited (it is assumed that a Windows fileshare is intended).

  Example:
     p_string = '/Users/Documents//my_data/';
     p_string_out = vlt.file.tidypathstring(p_string,'/')
        % p_string_out = '/Users/Documents/my_data'