'  FF_REMAIN
'  返回字符串的一部分，在第一次出现的字符或字符组。相关函数 FF_EXTRACT.
'  主要是在 MainString  寻找 MatchPattern。
'  如果找到，返回找到 MatchPattern 之后的字符。
'  如果没找到（或MatchPattern为空）返回长度为零的空字符串。
'  这个函数是区分大小写的。 
'  Function FF_Remain( ByRef nStart        as Integer, _
'                      ByRef sMainString   as String, _
'                      ByRef sMatchPattern as String _
'                      ) as String
''
''  FF_REMAIN
''  Return the portion of a string following the first occurrence of 
''  a character or group of characters. Compliment function to FF_EXTRACT.
''
''  MainString is searched for the string specified in MatchPattern. If found, 
''  all characters after MatchPattern are returned. 
''  If MatchPattern is not present in MainString (or is null) then a 
''  zero-length empty string is returned.
''  This function is case-sensitive. 
''
Function FF_Remain( ByRef nStart        as Integer, _
                    ByRef sMainString   as String, _
                    ByRef sMatchPattern as String _
                    ) as String

    Dim nLenMain as Integer = Len(sMainString)
    Dim i as Integer
    
    If (nStart = 0) Or (nStart > nLenMain) Then Return ""
    If nStart < 0 Then nStart = nLenMain + nStart + 1
    
    i = InStr(nStart, sMainString, sMatchPattern)
    If i Then
       Function = Mid(sMainString,i+Len(sMatchPattern)) 
    Else
       Function = ""
    End If   
End Function


