?
Solved

How to search for substring in a Text List field?

Posted on 2005-04-13
4
Medium Priority
?
2,916 Views
Last Modified: 2013-12-18
Hi,

Using LotusScript, how do I search for a substring in a Text List? Example Text List:

"text string one"
"text string two"
"asdf asdf asdf"
"asdf [findme]: asdf asdf"
"asdf [findme]: asdf asdf"       << want this string
"last string"

Given doc.TextListField, how do I get the last text string that contains "findme"?  Thanks.
0
Comment
Question by:pw05
  • 2
  • 2
4 Comments
 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 1000 total points
ID: 13773393
   Dim tlf As Variant
    Dim index As Integer
    Dim found As Integer

    tlf= doc.TextListField
    For index= Ubound(tlf) To 0 Step -1
        If Instr(tlf(index), "findme")>0 Then
            found= True
            Exit For    
        End If
    Next
    If found Then ' index is valid...
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 13773416
Hi pw05,

count = 0
found = false
content = ""
position = -1
Forall part In doc.TextListFeldName
    If Instr(part,"findme") > 0 Then
        position = count
        content = part
        found = true
    End If
    count = count + 1
End Forall

If found Then
    MsgBox content &" found at position " & position,,doc.TextListFeldName(position)
Else
    MsgBox "Not found anywhere"
End If

Cheers!
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 1000 total points
ID: 13773443
Sef's is a little more efficient.  Goud thinking, going in from the bottom!

But, it needs to indicate WHERE it was found, so...
   Dim tlf As Variant
    Dim index As Integer
    Dim found As Integer

    tlf= doc.TextListField
    For index= Ubound(tlf) To 0 Step -1
        If Instr(tlf(index), "findme")>0 Then
            found= True
            position = index
            content = tlf(index)
            Exit For    
        End If
    Next
    If found Then ' index is valid...
    MsgBox content &" found at position " & position,,doc.TextListFeldName(position)
Else
    MsgBox "Not found anywhere"
End If
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 13773485
Hi Qwaletee,

> it needs to indicate WHERE it was found

Says who? ;)

Sjef
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question