Function Formats Justifies Class

RightJustifyTruncateFast

Right justify a string. Undersized strings are left-padded with spaces. Oversized strings have their left side truncated so that the result string always has length vWidth. "Fast" function has restrictive argument types to avoid argument fix-up code.

Signature (Visual Basic / VBA)

Public Function RightJustifyTruncateFast( _
      ByRef vValue As String _
    , ByVal vWidth As Long _
    ) As String

Code Example

    RightJustifyTruncateFast("This is a test.", 20) = "     This is a test."
    RightJustifyTruncateFast("This is a test.", 10) = "is a test."

Parameters

Parameter Description
vValue String which is to be right-justified.
vWidth Length to which the string vValue will be space-filled or truncated.