Function String Words Class

AddSpaceBeforeCapitals

Adds spaces before the last capital letter in all sequences of one or more capital letters. Function does not add a space before the first character of the word if it is otherwise a candidate capital letter.

Signature (Visual Basic / VBA)

Public Function AddSpaceBeforeCapitals( _
    ByVal vValue As Variant _
    ) As Variant

Code Example

    AddSpaceBeforeCapitals("CBACorp") = "CBA Corp"
    AddSpaceBeforeCapitals("AddSpaceBeforeCapitals") = "Add Space Before Capitals"

Parameters

Parameter Description
vValue The string which is to have space characters added before trailing capital letters. Function returns Null if vValue is Null or cannot be fixed up to a String.

Notes & Version History

Note Function uses the built-in character classification routines to determine which characters are upper-case.
Note If there is a single capital letter at the beginning of the line (followed by nothing else or followed by a non-capital letter), the function does not add a space before that capital letter.