<-- Previous || Up || Next -->

Truncate Right With Ellipse Function
String Manipulations Class

Public Function TruncateRightWithEllipse( _
      ByVal vLine As Variant _
    , ByVal vMaxLen As Variant _
    ) As Variant

Truncate the left of a string if it is longer than MaxLen,
If the string is truncated, replace the leading characters with "..." to indicate the removal.

Examples:
    TruncateRightWithEllipse("This is a test.", 20) = "This is a test."
    TruncateRightWithEllipse("This is a test.", 11) = "This is ..."
    TruncateRightWithEllipse("This is a test.", 10) = "This ..."
See also:
    TruncateLeftWithEllipse Function
    LeftJustifyTruncateFast Function
vLine: The string value which is a candidate for truncation. Function returns Null if vLine is Null or cannot be fixed up to a String.

vMaxLen: The maximum length of the string, above which size the string vLine will be truncated. Function returns Null if vMaxLen if Null or cannot be fixed up to a number.

Function returns an empty string if vMaxLen is <= 0 (less than or equal to zero).

Fully remove any partial word which would be left where the oversized part of the string is truncated.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.