Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
$, but for words
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00823290
Message ID:
00823297
Views:
21
How about, off the top of my head:
lcFindMe = [fox]
lcLookIn = [foxy lady scanfox]
? WordIn(lcFindMe, lcLookIn)
lcLookIn = [foxy fox lady scanfox]
? WordIn(lcFindMe, lcLookIn)
lcLookIn = [fox lady scanfox]
? WordIn(lcFindMe, lcLookIn)
lcLookIn = [foxy lady scan fox]
? WordIn(lcFindMe, lcLookIn)

function WordIn
lParameters tcWordToFind, tcStringToLookIn

local lcLookFor, llFoundOne
llFoundOne = .f.
lcLookFor = lower(tcWordToFind)

if [ ] + lcLookFor + [ ] $ lower(tcStringToLookIn) or ;
  left(lower(tcStringToLookIn), len(lcLookFor + [ ])) == lcLookFor + [ ] or ;
  right(lower(tcStringToLookIn), len([ ] + lcLookFor)) == [ ] + lcLookFor

  llFoundOne = .t.

endif

return llFoundOne
>I want to find certain words in a string. meaning the word can be at the beginning of the string followed by a space, at the end of the string preceeded by a space, or in the middle of the string both preceeded and followed by a space. I use VFP 6.0 SP5. How can I accomplish this without my current bunch of goobly gook code.
>
>Thanks
>
>Brenda


If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?


From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."


All my FoxTalk and other articles are available on my web site.


Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.
Previous
Reply
Map
View

Click here to load this message in the networking platform