Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Punctuation function?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00394664
Message ID:
00394707
Vues:
10
Eric,
Try something like the following:
lparameters lcstring
lctemp = lcstring
lctemp = chrtran(lctemp,'!@#$%^%&*()_-+=~[]{}\|;:<>.",/?'+chr(39),replicate(chr(177),32))
return chr(177) $ lctemp
Cheers.

>Well I know its kinda late and i couldnt wait so here it is if anyone wants to use it..
>
>If you make any modifications to speed up or better it, let me know so i can incorperate them. ;)
>
>*Returns .t. if the string contains any punctuation, .f. if it does not contain punctuation, 0 if its not a string.
>*Note: does not test for the single quote character ex: '
>FUNCTION ContainPunc
> LPARAMETERS lcstring
>
> IF TYPE('lcstring')<>'C'
> RETURN 0
> ELSE
> FOR i = 1 TO LEN(lcstring)
> lcCharToTest=SUBSTR(lcstring, i,1)
> IF INLIST(lcCharToTest, '!','@','#','$','%','^','%','&','*','(',')','_','-','+','=','~','[',']','{','}','\','|',';',':')=.T. OR INLIST(lcCharToTest, '<','>','.','"',',','/','?')=.T.
> RETURN .T.
> ENDIF
> ENDFOR
> RETURN .F.
> ENDIF
>ENDFUNC
>
>Take care...
>Eric
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform