Re: Find words within range of other word in string?????????
- From: "Larry Serflaten" <serflaten@xxxxxxxxxxxxxx>
- Date: Fri, 4 Aug 2006 12:56:23 -0500
"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
.
- Follow-Ups:
- Re: Find words within range of other word in string?????????
- From: expvb
- Re: Find words within range of other word in string?????????
- From: vonClausowitz
- Re: Find words within range of other word in string?????????
- References:
- Prev by Date: Re: Slot Machine Code
- Next by Date: Re: How to speed up code?
- Previous by thread: Re: Find words within range of other word in string?????????
- Next by thread: Re: Find words within range of other word in string?????????
- Index(es):
Relevant Pages
|