Monday, 28 November 2011

Normalize String

The NormalizeString function receives a string and returns the equivalent string in regular expression
Function NormalizeString(OrgStr)
    Dim TempStr
    TempStr = Replace(OrgStr, “\”, “\\”)
    TempStr = Replace(TempStr, “*”, “\*”)
    TempStr = Replace(TempStr, “+”, “\+”)
    TempStr = Replace(TempStr, “.”, “\.”)
    NormalizeString = Replace(TempStr, “?”, “\?”)
End function
‘Calling the function 
msgbox NormalizeString (“vinod kumar. *”)

No comments:

Post a Comment