Hello
I have to select a word in a text and i think that a dll can do that for me
like Find(text,word)
and returning the text with the selected word
do you know a dll for this pb?
Thanks
07-02-2003 at 03:15 PM
|
vbgen Level: Moderator Registered: 10-10-2002 Posts: 876
Re: search a word in a text
i don't know of any existing dll that does this, but i could give you an idea so that you can create your own dll, or perhaps place it in a module or class...
the idea would be to take the word to be searched, and get its first letter, then search the text. when the 1st letter is encountered, then go back to the word and get the next letter. if it doesn't match, then go back to the first letter, then continue searching... do this until the word is completed...
the problem would be if there were to exist many words of that kind.
could you explain instead what you need this code for?
there could be another way to do this task.
____________________________
Been busy trying to take a second degree <--it's not working out...
18-02-2003 at 05:42 PM
|
vbgen Level: Moderator Registered: 10-10-2002 Posts: 876
Re: search a word in a text
i got this from somewhere in the net... hope it helps you.
don't know a dll that does this... but of course you could manipulate this and insert it in a module, class... create your dll!
Dim ErrCnt As Long
Dim Swords(5) As String
Dim ErrFnd As Boolean
Private Sub Form_Load()
'Words in array to search for
Swords(0) = "these"
Swords(1) = "are"
Swords(2) = "words"
Swords(3) = "to"
Swords(4) = "be"
Swords(5) = "searched"
End Sub
Private Sub Command1_Click()
'set trigger to false
ErrFnd = False
' loop from swords(0) to swords(5)
For x = 0 To 5
'if one of the swords is found
If Instr(1, Text1, Swords(x)) > 0 Then
' activate flag
ErrFnd = True
' Show result
MsgBox "Found Word " & Swords(x)
'count how many words
ErrCnt = ErrCnt + 1
' end if statement
End If ' end loop
Next
'if the flag was activated
If ErrFnd = True Then
'show how many words were found
MsgBox ErrCnt & " Words found"
' set the word count back to 0
ErrCnt = 0
' end if statement
End If
End Sub
see yah!
____________________________
Been busy trying to take a second degree <--it's not working out...
I don't know a dll that does this,but you can use some c# word component to search a word ,like Spire.Doc,I use it long time, quit good. May help to you.