@Left, @Right, @Leftback, @Rightback, And @Word @Functions

Here are the LotusScript equivalents for the @Left, @Right, @LeftBack,
@RightBack, and @Word @functions
.

Function Left (sourceString As String, searchString As String) As String
pos% = Instr(sourceString, searchString)
If pos% > 0 Then pos% = pos% -1
Left = Left(sourceString, pos%)
End Function

Function Right (sourceString As String, searchString As String) As String
pos% = Instr(sourceString, searchString)
length% = Len(sourceString)
start% = length% - pos%
Right = Right(sourceString, start%)
End Function

Function LeftBack (sourceString As String, searchString As String) AsString
For i% = Len(sourceString) To 1 Step -1
sourceStringBack$=sourceStringBack$ & Mid(sourceString, i%, 1)
Next
For i% = Len(searchString) To 1 Step -1
searchStringBack$=searchStringBack$ & Mid(searchString, i%, 1)
Next
pos% = Instr(sourceStringBack$, searchStringBack$)
length% = Len(sourceStringBack$)
start% = length% - pos%
result$ = Right (sourceStringBack$, start%)
For i% = Len(result$) To 1 Step -1
turn$=turn$ & Mid(result$, i%, 1)
Next
LeftBack=turn$
End Function

Function RightBack (sourceString As String, searchString As String) As String
For i% = Len(sourceString) To 1 Step -1
sourceStringBack$=sourceStringBack$ & Mid(sourceString, i%, 1)
Next
For i% = Len(searchString) To 1 Step -1
searchStringBack$=searchStringBack$ & Mid(searchString, i%, 1)
Next
pos% = Instr ( sourceStringBack$, searchStringBack$)
If pos% > 0 Then pos% = pos% - 1
result$ = Left ( sourceStringBack$, pos%)
For i% = Len(result$) To 1 Step -1
turn$=turn$ & Mid(result$, i%, 1)
Next
RightBack=turn$
End Function

Function Word (sourceString As String, separator As String, number As Integer)
As String
searchString$=SourceString & separator ' add one separator to catch also the
last substring
For i% = 1 To number
pos%=Instr(searchString$, separator)
If pos%=0 Then Exit For
substring$=Left(searchString$,pos%-1)
searchString$=Mid(searchString$, pos%+1)
Next
If pos% > 0 Then
Word=substring$
Else
Word=""
End If
End Function
This was first published in November 2000

Dig deeper on Lotus Notes Domino Administration Tools

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close