Private Sub ReplaceStringNTimesVerify() 'Test the ReplaceStringNTimes function. Debug.Assert IsNull(ReplaceStringNTimes(Null, "cA", "-")) ' Behavior #1 Debug.Assert IsNull(ReplaceStringNTimes("AbcAbcAbc", Null, "-")) ' Behavior #2 Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "", "-") = "AbcAbcAbc" ' Behavior #3 Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "cA") = "AbbcAbc" ' Behavior #4 Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "cA", Null) = "AbbcAbc" Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "cA", "") = "AbbcAbc" ' Behavior #5 Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "Ab", "AbAb") = "AbAbcAbcAbc" ' Behavior #6 Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "cA", "-", vbBinaryCompare) = "Ab-bcAbc" ' Behavior #7 Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "ca", "-", vbBinaryCompare) = "AbcAbcAbc" Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "cA", "-", vbTextCompare) = "Ab-bcAbc" Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "ca", "-", vbTextCompare) = "Ab-bcAbc" Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "cA", "-") = "Ab-bcAbc" ' Behavior #8 Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "ca", "-") = "AbcAbcAbc" Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "ca", "-", Null) = "AbcAbcAbc" Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "ca", "-", "Joe") = "AbcAbcAbc" Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "bc", "-", , 0) = "AbcAbcAbc" ' Behavior #9 Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "bc", "-", , 1) = "A-AbcAbc" Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "bc", "-", , 10) = "A-A-A-" Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "bc", "-") = "A-AbcAbc" ' Behavior #10 Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "bc", "-", , Null) = "A-AbcAbc" Debug.Assert ReplaceStringNTimes("AbcAbcAbc", "bc", "-", , "Joe") = "A-AbcAbc" End Sub
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.