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

Replace String Multiple Verify Sub
String Replacements Class

Private Sub ReplaceStringMultipleVerify()
    'Test the ReplaceStringMultiple function.

    Debug.Assert IsNull(ReplaceStringMultiple(Null, "A|Adam|B|Boy|C|Charlie", "|")) ' Behavior #1

    Debug.Assert IsNull(ReplaceStringMultiple("A B C", Null, "|")) ' Behavior #2
    
    Debug.Assert ReplaceStringMultiple("A B C", "", "|") = "A B C" ' Behavior #3

    Debug.Assert ReplaceStringMultiple("ABC", "A|AA|B|BBB|C|CCCC", "|") = "AABBBCCCC" ' Behavior #4
    
    Debug.Assert ReplaceStringMultiple("123", "1z11z2z222z3z3333", "Z") = "123" ' Behavior #5

    Debug.Assert IsNull(ReplaceStringMultiple("A B C", "A|Adam|B|Boy|C|Charlie", Null)) ' Behavior #6

    Debug.Assert ReplaceStringMultiple("A B", "A|Adam|B|Boy", "|", vbBinaryCompare) = "Adam Boy" ' Behavior #7
    Debug.Assert ReplaceStringMultiple("a b", "A|Adam|B|Boy", "|", vbBinaryCompare) = "a b"
    Debug.Assert ReplaceStringMultiple("A B", "A|Adam|B|Boy", "|", vbTextCompare) = "Adam Boy"
    Debug.Assert ReplaceStringMultiple("a b", "A|Adam|B|Boy", "|", vbTextCompare) = "Adam Boy"

    Debug.Assert ReplaceStringMultiple("A B", "A|Adam|B|Boy", "|") = "Adam Boy" ' Behavior #8
    Debug.Assert ReplaceStringMultiple("a b", "A|Adam|B|Boy", "|") = "a b"
    Debug.Assert ReplaceStringMultiple("a b", "A|Adam|B|Boy", "|", Null) = "a b"
    Debug.Assert ReplaceStringMultiple("a b", "A|Adam|B|Boy", "|", "Joe") = "a b"

    Debug.Assert ReplaceStringMultiple("A AB B", "AB|Able|A|Ant|B|Boy", "|") = "Ant AntBoy Boy" ' Behavior #9
    Debug.Assert ReplaceStringMultiple("A AB B", "A|Ant|AB|Able|B|Boy", "|") = "Ant Able Boy"

End Sub

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