Truncate Path

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • markstaylor
    Indigo Rose Customer
    • Oct 2003
    • 296

    Truncate Path

    Any suggestions or code on how to take a path string that is larger than a label or paragraph in width and truncate it to fit with the begining and end of the string legiable?

    from...
    C:\Documents and Settings\mtaylor\Desktop\Autoplay 5.0\Samples\This is a good one.exe

    to...
    C:\Documents and Settings\mtaylor....\Samples\This is a good one.exe

    I want to make a function that will work for any size of label or paragraph one line.
    SELECT * FROM Users WHERE IQ > 0;
    o rows Returned
  • Corey
    Indigo Rose Staff Alumni
    • Aug 2002
    • 9745

    #2
    Hi. Paths are stored in a table. So if you wish, you could tally the characters and then use String.Replace to turn long paths into short ones by replacing the centermost table items woth "..." then when you display the concatenated path table contents it should fit whatever length you set it to and still show the correct start/end points as in your example. One idea anyhow.

    Comment

    • Dermot
      Indigo Rose Customer
      • Apr 2004
      • 1791

      #3
      If you can figure out how many characters fit in the label you could use something like this.

      Let's say it can hold about 65 characters

      Code:
      LabelText = String.Left("Your Path", 30) .. "...." .. String.Right("Your Path", 30)
      Label.SetText("Your Label", LabelText)
      Dermot
      Dermot

      I am so out of here :yes

      Comment

      • markstaylor
        Indigo Rose Customer
        • Oct 2003
        • 296

        #4
        Thanks Dermot for the code, I was able to get that work.

        Corey, do you have any example of how to code it from a table like you had stated?


        Thanks
        SELECT * FROM Users WHERE IQ > 0;
        o rows Returned

        Comment

        Working...
        X