@Left & @Right equivalents in LotusScript

The LotusScript "Left" and "Right" functions can only use the numerical place-holder and not search for specific string value. The code below will allow you to mimic the functionality of the @Left and @Right commands in formula.
LotusScript

@Left

Function AtLeft(valuein As String, delimiter As String) As String
	
	valueout=""     
	Dim valueLength As Integer
	valueLength = Len(valuein)
	
	For i=1 To valueLength Step 1
		If Mid(valuein,i,1)=delimiter Then
			valueout =Left (valuein, i-1 )
			Exit For
		End If
	Next
	
	AtLeft = valueout
	
End Function

@Right

Function AtRight(valuein As String, delimiter As String) As String
	
	valueout=""     
	Dim valueLength As Integer
	valueLength = Len(valuein)
	
	For i=valueLength To 1 Step -1
		If Mid(valuein,i,1)=delimiter Then
			If i > 1 Then
				valueout =Right (valuein, valueLength - i )
			End If
			Exit For
		End If
	Next
	
	AtRight = valueout
	
End Function

Posted by fbrefere001 on Wednesday December 5, 2001