'''
'''  FF_RETAINANY
'''  返回一个包含只有指定的匹配字符串中包含的字符的字符串。删除所有其他字符。
'''
'''  如果MatchPattern是一个空字符串，函数将返回一个空字符串。
'''  MatchPattern 指定单个字符将被单独地，搜寻的列表
'''  任何一种的匹配将导致该字符将从结果中删除。
'''  这个函数是区分大小写。
'''
'  Function FF_RetainAny( ByRef sMainString   as String, _
'                         ByRef sMatchPattern as String _
'                         ) as String
''
''  FF_RETAINANY
''  Return a string containing only the characters contained in a specified 
''  match string. All other characters are removed.
''
''  If MatchPattern is an empty string the function returns an empty string.
''  MatchPattern specifies a list of single characters to be searched for individually, 
''  a match on any one of which will cause that character to be removed from the result.
''  This function is case-sensitive. 
''
Function FF_RetainAny( ByRef sMainString   as String, _
                       ByRef sMatchPattern as String _
                       ) as String

    Dim nLenMain  as Integer = Len(sMainString)
    Dim nLenMatch as Integer = Len(sMatchPattern)
    If nLenMatch = 0 Then Return ""
    
    Dim y     as Integer = 1
    Dim i     as Integer = 1
    Dim sChar as String
    Dim s     as String 
    
    For y = 1 To Len(sMainString)      
        sChar = Mid(sMainString, y, 1)
        i = InStr( sMatchPattern, sChar )
        If i > 0 Then s = s & sChar
    Next
    
    Return s

End Function

