@Left, @Right, @Leftback, @Rightback, @Word In Lotusscript


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

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

Function sLeftBack ( 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$ )
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
sLeftBack=turn$
End Function

Function sRightBack ( 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
sRightBack=turn$
End Function

Function sWord ( 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
sWord=substring$
Else
sWord=""
End If
End Function

This was last published in November 2000

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

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

SearchDataCenter

SearchExchange

SearchContentManagement

Close