Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Searching Records for an occurrence of a word
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00220525
Message ID:
00220534
Views:
24
>My main question is regarding a keyword that will return .t. if a substring exists in another string. I found the command strtran but this would replace the substring with another string.
>
>I am trying to come up with a peice of code that will return a subset of all records in a table that a particular word occurs in one or more fields.
>
>Thanks,
>Paul

Paul,

There is no easy way to find the occurance of a word within a field in VFP. The $ operator is where you want to start, but it can't do the whole job. The $ returns whether one string is found within another.

The problem is that if you are looking for the word "the" within a string "this is other stuff", then the $ tells you the word is there when it isn't. You'd need to look for " the ", "the ", " the", " the.", ", the", ",the" and all other permutations for that to get a complete check for the existance of the word the in the string.
Previous
Reply
Map
View

Click here to load this message in the networking platform