VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Variation of Paul Leyten's Path Clipper thing.

by MudBlud (8 Submissions)
Category: String Manipulation
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

splits a path up a path and shortens parts to make it shorter.
e.g.
c:\program files\blingblongblu\bah\bleh.exe
c:\program...\blingbl...\bah\bleh.exe

Inputs
path
Code Returns
shorten'd path

Rate Variation of Paul Leyten's Path Clipper thing.

Private Function ShortenPath(Path As String, MaxLen As Integer) As String
Dim bleh() As String
bleh = Split(Path, "\")
For x = 0 To UBound(bleh)
  If Not x = UBound(bleh) Then
    If Len(bleh(x)) > MaxLen Then
      bleh(x) = Mid$(bleh(x), 1, MaxLen - 3) & "..."
    End If
    tmp = tmp & bleh(x) & "\"
  Else
    tmp = tmp & bleh(x)
  End If
Next
ShortenPath = tmp
End Function

Download this snippet    Add to My Saved Code

Variation of Paul Leyten's Path Clipper thing. Comments

No comments have been posted about Variation of Paul Leyten's Path Clipper thing.. Why not be the first to post a comment about Variation of Paul Leyten's Path Clipper thing..

Post your comment

Subject:
Message:
0/1000 characters