'''
'''  FF_RETAIN
'''  返回一个包含只有指定的匹配字符串中包含的字符的字符串。删除所有其他字符。
'''
'''  If MatchPattern is an empty string the function returns an empty string.
'''  This function is case-sensitive. 
'''
'  Function FF_Retain( ByRef sMainString   as String, _
'                      ByRef sMatchPattern as String _
'                      ) as String


''
''  FF_RETAIN
''  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.
''  This function is case-sensitive. 
''
Function FF_Retain( ByRef sMainString   as String, _
                    ByRef sMatchPattern as String _
                    ) as String

    Dim nLenMatch as Integer = Len(sMatchPattern)
    If nLenMatch = 0 Then Return ""
    
    Dim i as Integer = 1
    Dim s as String 
    
    Do
        i = InStr(i, sMainString, sMatchPattern)
        If i > 0 Then 
           s = s & Mid(sMainString, i, Len(sMatchPattern)) 
           i = i + Len(sMatchPattern)
        End If   
    Loop Until i = 0
   
    Return s

End Function


