Re: Find words within range of other word in string?????????



Looks great guys, but how does that tell me how far certain words are
away from each other?

Marco

Larry Serflaten schreef:

"expvb" <nobody@xxxxxxx> wrote
Here is a word separator routine that is not based on regular expressions

A little different approach, since all we want are the text characters, we
can simply exclude anything that isn't a character, without having to
define each and every word separator:

LFS


Private Sub Form_Load()
Dim text As String
Dim pos&, idx&
Dim words As New Collection

text = "Just some demo-text, with a few ©dd characters @dded."

For idx = 1 To Len(text)
Select Case Asc(Mid$(text, idx, 1))
Case 65 To 90, 97 To 122
If pos = 0 Then pos = idx
Case Else
If pos > 0 Then
words.Add Mid$(text, pos, idx - pos)
pos = 0
End If
End Select
Next


For idx = 1 To words.Count
Debug.Print idx, words(idx)
Next

End Sub

.



Relevant Pages