Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String in a String Exact Match
Message
From
19/09/2007 14:09:20
 
 
To
19/09/2007 12:23:58
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01255518
Message ID:
01255575
Views:
18
>I am tring to find a way to check for a string within a string but what I have came uo with is strill not working every time.
>
>I am using the AT() function but this fails if my:
>
>search expression is revJ
>and searched expression is 855956-401 revJ2
>
>J and J2 are two different revision levels.
>
>Sometimes searched expression can be more complex like:
>855965-401 revJ2, 855965-403 revJ2, 855965-405 revJ2
>
>Any ideas?

Can you check the next character against a list of valid delimiters? Something like
llFound = .F.
nPos = AT(lcRevision,lcExpression)
IF nPos+LEN(lcRevision)-1 = LEN(lcExpression)
    llFound = .T.
    ELSE
        llFound = INLIST(SUBSTR(lcExpression,nPos+LEN(lcRevision),1),","," ",";",'.')
    ENDIF
ENDIF
I don't have a solution for more complex search expressions that have two revision built in. What should happen, for example, to

855965-401 revJ, 855965-403 revJ1, 855965-405 revJ2
or
855965-401 revJ2, 855965-403 revJ1, 855965-405 revJ

but if the code works for the simple case you might be able to play around with the nOccurence parameter of AT().
Previous
Reply
Map
View

Click here to load this message in the networking platform