'********************************************************************
'* Function RAddText
'*
'* Author: NetworkAdminKB.com
'* Created: 2006-08-22
'* Modified: 2008-12-06
'*
'* Purpose: Returns a string with the text added to the Right side of
'* the String, only if it does not already exist.
'*
'* Input: strText The string to have the Text Added to.
'* strAdd The string to Add to the Right side of strText.
'*
'* Output: Returns the string plus the text added to the right
'* side of the string, only if the text does not
'* already exist.
'*
'* Calls:
'* ReturnCaseComparisonValue
'*
'* Changes:
'* 2007-01-11: Added blnCase and intSearch
'* 2008-12-06: Replaced intSearch with ReturnCaseComparisonValue
'********************************************************************
Function RAddText(ByVal strText, ByVal strAdd, ByVal blnCase)
'Version 1.2 2008-12-06
Dim intAddLen, intTextLen, strTemp, intSearch
intAddLen = Len(strAdd)
intTextLen = Len(strText)
intSearch = ReturnCaseComparisonValue(blnCase)
'Off by one error is added to intTextLen instead of subtracted from the
'other side.
If InStrRev(strText, strAdd, -1, intSearch) + intAddLen = intTextLen + 1 Then
'Sting already exists at the end
strTemp = strText
Else
'Sting does not exsit at the end, so add it
strTemp = strText & strAdd
End If 'InStrRev(strText, strAdd, -1, intSearch) + intAddLen = intTextLen + 1
RAddText = strTemp
End Function 'RAddText
Article ID: 411, Created On: 9/25/2011, Modified: 9/25/2011