Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String in a String Exact Match
Message
De
19/09/2007 14:09:20
 
 
À
19/09/2007 12:23:58
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01255518
Message ID:
01255575
Vues:
16
>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().
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform