Function Formats Justifies Class

FormatLeftJustifyTruncateFast

Apply the Visual Basic Format function then left justify the result. Undersized strings are right-padded with spaces to length vWidth. Oversized strings right-truncated to length vWidth. "Fast" function has restrictive argument types to avoid argument fix-up code.

Signature (Visual Basic / VBA)

Public Function FormatLeftJustifyTruncateFast( _
      ByRef vValue As Variant _
    , ByRef vFormat As String _
    , ByVal vWidth As Long _
    ) As String

Code Example

    FormatLeftJustifyTruncateFast(12345, "#,##0", 10) = "12,345    "
    FormatLeftJustifyTruncateFast(12345, "#,##0",  5) = "12,34"

Parameters

Parameter Description
vValue Value which is to formatted. The formatted result is left-justified.
vFormat Format specification recognized by the Visual Basic Format function.
vWidth Length to which the formatted result will be space-filled or truncated.