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

Replace Character Verify Sub
String Replacements Class

Private Sub ReplaceCharacterVerify()
    'Test the ReplaceCharacter function.

    Debug.Assert IsNull(ReplaceCharacter(Null, "C", "-")) ' Behavior #1

    Debug.Assert ReplaceCharacter("ABCABC", "", "-") = "ABCABC" ' Behavior #2

    Debug.Assert ReplaceCharacter("ABCABC", "CAB", "-") = "AB-AB-" ' Behavior #3

    Debug.Assert ReplaceCharacter("ABCABC", 67, "-") = "AB-AB-" ' Behavior #4
    
    Debug.Assert IsNull(ReplaceCharacter("ABCABC", Null, "-")) ' Behavior #5

    Debug.Assert ReplaceCharacter("ABCABC", "C", "") = "ABCABC" ' Behavior #6

    Debug.Assert ReplaceCharacter("ABCABC", "C", "-!@") = "AB-AB-" ' Behavior #7

    Debug.Assert ReplaceCharacter("ABCABC", "C", 45) = "AB-AB-" ' Behavior #8

    Debug.Assert IsNull(ReplaceCharacter("ABCABC", "C", Null)) ' Behavior #9

    Debug.Assert ReplaceCharacter("ABCABC", "C", "-", vbBinaryCompare) = "AB-AB-" ' Behavior #10
    Debug.Assert ReplaceCharacter("ABCABC", "c", "-", vbBinaryCompare) = "ABCABC"
    Debug.Assert ReplaceCharacter("ABCABC", "C", "-", vbTextCompare) = "AB-AB-"
    Debug.Assert ReplaceCharacter("ABCABC", "c", "-", vbTextCompare) = "AB-AB-"

    Debug.Assert ReplaceCharacter("ABCABC", "C", "-") = "AB-AB-" ' Behavior #11
    Debug.Assert ReplaceCharacter("ABCABC", "c", "-") = "ABCABC"
    Debug.Assert ReplaceCharacter("ABCABC", "c", "-", Null) = "ABCABC"
    Debug.Assert ReplaceCharacter("ABCABC", "c", "-", "Joe") = "ABCABC"

End Sub

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