Code Block |
---|
| 'Tests copied from http://msdn.microsoft.com/en-us/library/swf8kaxw.aspx
' The following statement returns True (does "F" satisfy "F"?)
wBA "Like", "'F' Like 'F'", "F" Like "F"
'
' The following statement returns False for Option Compare Binary
' and True for Option Compare Text (does "F" satisfy "f"?)
wBA "Like", "'F' Like 'f'", "F" Like "f"
'
' The following statement returns False (does "F" satisfy "FFF"?)
wBA "Like", "'F' Like 'FFF'", "F" Like "FFF"
'
' The following statement returns True (does "aBBBa" have an "a" at the
' beginning, an "a" at the end, and any number of characters in
' between?)
wBA "Like", "'aBBBa' Like 'a*a'", "aBBBa" Like "a*a"
'
' The following statement returns True (does "F" occur in the set of
' characters from "A" through "Z"?)
wBA "Like", "'F' Like '[A-Z]'", "F" Like "[A-Z]"
'
' The following statement returns False (does "F" NOT occur in the
' set of characters from "A" through "Z"?)
wBA "Like", "'F' Like '[!A-Z]'", "F" Like "[!A-Z]"
'
' The following statement returns True (does "a2a" begin and end with
' an "a" and have any single-digit number in between?)
wBA "Like", "'a2a' Like 'a#a'", "a2a" Like "a#a"
'
' The following statement returns True (does "aM5b" begin with an "a",
' followed by any character from the set "L" through "P", followed
' by any single-digit number, and end with any character NOT in
' the character set "c" through "e"?)
wBA "Like", "'aM5b' Like 'a[L-P]#[!c-e]'", "aM5b" Like "a[L-P]#[!c-e]"
'
' The following statement returns True (does "BAT123khg" begin with a
' "B", followed by any single character, followed by a "T", and end
' with zero or more characters of any type?)
wBA "Like", "'BAT123khg' Like 'B?T*'", "BAT123khg" Like "B?T*"
'
' The following statement returns False (does "CAT123khg"?) begin with
' a "B", followed by any single character, followed by a "T", and
' end with zero or more characters of any type?)
wBA "Like", "'CAT123khg' Like 'B?T*'", "CAT123khg" Like "B?T*" |
| Code Block |
---|
| // Tests copied from http://msdn.microsoft.com/en-us/library/swf8kaxw.aspx
//
// The following statement returns True (does "F" satisfy "F"?)
wBA("Like","'F' Like 'F'",Regex.IsMatch("F","F").ToString());
//
The following statement returns False for Option // The following statement returns False for Option Compare Binary
// and True for Option Compare Text (does "F" satisfy "f"?)
wBA("Like","'F' Like 'f'",Regex.IsMatch("F","f").ToString());
//
// The following statement returns False (does "F" satisfy "FFF"?)
wBA("Like","'F' Like 'FFF'",Regex.IsMatch("F","FFF").ToString());
//
// The following statement returns True (does "aBBBa" have an "a" at the
// beginning, an "a" at the end, and any number of characters in
// between?)
wBA("Like","'aBBBa' Like 'a*a'",Regex.IsMatch("aBBBa","a.*a").ToString());
//
// The following statement returns True (does "F" occur in the set of
// characters from "A" through "Z"?)
wBA("Like","'F' Like '[A-Z]'",Regex.IsMatch("F","[A-Z]").ToString());
//
The following statement returns False (does // The following statement returns False (does "F" NOT occur in the
// set of characters from "A" through "Z"?)
wBA("Like","'F' Like '[!A-Z]'",Regex.IsMatch("F","[^A-Z]").ToString());
//
// The following statement returns True (does "a2a" begin and end with
// an "a" and have any single-digit number in between?)
wBA("Like","'a2a' Like 'a#a'",Regex.IsMatch("a2a","a\\da").ToString());
//
// The following statement returns True (does "aM5b" begin with an "a",
// followed by any character from the set "L" through "P", followed
// by any single-digit number, and end with any character NOT in
// the character set "c" through "e"?)
wBA("Like","'aM5b' Like 'a[L-P]#[!c-e]'",Regex.IsMatch("aM5b","a[L-P]\\d[^c-e]").ToString());
//
// The following statement returns True (does "BAT123khg" begin with a
// "B", followed by any single character, followed by a "T", and end
// with zero or more characters of any type?)
wBA("Like","'BAT123khg' Like 'B?T*'",Regex.IsMatch("BAT123khg","B.?T.*").ToString());
//
The following statement returns False (does // The following statement returns False (does "CAT123khg"?) begin with
// a "B", followed by any single character, followed by a "T", and
// end with zero or more characters of any type?)
wBA("Like","'CAT123khg' Like 'B?T*'",Regex.IsMatch("CAT123khg","B.?T.*").ToString()); |
|