<?xml version="1.0" encoding="utf-16"?>
<Function xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.caseware-idea.com/">
    <Author>Brian</Author>
    <DateModified>2012-10-22</DateModified>
    <FunctionName>TrimEnd</FunctionName>
    <Help>This script will remove the trailing characters that were defined.  The function takes a character field and the character that needs to be removed from the end of the field.</Help>
    <OutputType>Character</OutputType>
    <FunctionBody>Option Explicit
Function TrimEnd(p1 As String,p2 As String) As String

	Dim i As Integer
	Dim tempString As String
	
	tempString = p1
	
	For i = Len(p1) To 1 Step -1
		If Mid(p1,i,1) = p2 Then
			tempString = Mid(p1, 1, i - 1)
		Else
			trimend = tempString
			Exit For
		End If
	Next i

End Function
</FunctionBody>
    <Parameters>
        <Parameter>
            <Type>Character</Type>
            <Name>p1</Name>
            <Help>Character Field</Help>
        </Parameter>
        <Parameter>
            <Type>Character</Type>
            <Name>p2</Name>
            <Help>Character to remove</Help>
        </Parameter>
    </Parameters>
</Function>