Function String Words Class

CombineOverlappingWords

Combine words that overlap from the end of one phrase to the beginning of the other.

Signature (Visual Basic / VBA)

Public Function CombineOverlappingWords( _
      ByVal vLineOne As Variant _
    , ByVal vLineTwo As Variant _
    ) As Variant

Code Example

    CombineOverlappingWords("THIS IS A", "A STRING") = "THIS IS A STRING"
    CombineOverlappingWords("THIS IS A", "IS A STRING") = "THIS IS A STRING"
    CombineOverlappingWords("THIS IS", "A TEST") = "THIS IS A TEST"
    CombineOverlappingWords("THIS  IS A", "A STRING") = "THIS  IS A STRING" ' #4

Parameters

Parameter Description
vLineOne The left portion of the phrase whose right side is to be checked against the left side of vLineTwo. vLineOne defaults to an empty string if it is Null or cannot be fixed up to a String.
vLineTwo The right portion of the phrase whose left side is to be checked against the left side of vLineOne. vLineTwo defaults to an empty string if it is Null or cannot be fixed up to a String.

Notes & Version History

Details Function returns Null if both vLineOne and vLineTwo are Null.
Note The combined phrases are separated by a single space, even though all other spaces in the non-overlapping portions of the two phrases are preserved as in example #4.
Note Function uses the built-in character classification routines to determine which characters represent spaces.