'********************************************************************

'*

'* Function IsLastChar

'*

'*   Author: NetworkAdminKB.com

'*  Created: 2006-05-04

'* Modified: 2008-12-05

'*

'* Purpose: Returns True if the Last Character(s) of a string matches the

'*            the string Provided.

'*

'* Input:  strSearch = A string to be searched.

'*          strMatch = A string/Character to search for in strSearch.

'*           blnCase = A boolean indicating case sensitive searches

'*                       True  = Case Sensitive Search

'*                       False = Case Insensitive Search

'*

'* Output:  Returns True if the Last Character(s) of a string matches the

'*            the string Provided.

'*          Returns False if the string does not match.

'*

'* Calls:

'* ReturnCaseComparisonValue

'*

'* Changes:

'* 2006-12-01: Added blnCase as a parameter to support both case sensitive

'*               and case insensitive comparisons

'* 2006-12-01: Removed need for blnInstr subroutine

'* 2006-12-01: Changed from InStrRev to Right functions for gathering

'*               the correct protion of the search string.

'* 2008-12-05: Removed intSearch and use ReturnCaseComparisonValue instead.

'********************************************************************

Function IsLastChar(ByVal strSearch, ByVal strMatch, ByVal blnCase)

  'Version: 1.2 2008-12-05

  Dim strTemp, intLenMatch, intLenSearch, blnReturn

   

  intLenSearch = Len(strSearch)

  intLenMatch = Len(strMatch)

  

  If intLenSearch >= intLenMatch Then

    strTemp = Right(strSearch, intLenMatch)

    If InStr(1, strTemp, strMatch, ReturnCaseComparisonValue(blnCase)) = 1 Then

      blnReturn = True

    Else

      blnReturn = False

    End If 'InStr(1, strTemp, strMatch, intSearch) = 1

  End If 'intLenSearch >= intLenMatch

 

  IsLastChar = blnReturn

End Function 'IsLastChar

Article ID: 400, Created On: 9/25/2011, Modified: 9/25/2011