Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fastest way to verify to similar characters
Message
 
À
16/10/2001 18:35:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00569344
Message ID:
00569346
Vues:
18
>I need the fastest way to verify for similar characters in a variable. For example, I need to take action when I see a value such as "aaaaaaaa" or "bbbbbbbbbb". What's the best way to accomplish that?

I don't know about fastest, but here is an ugly way to do it :)
PROCEDURE SimChars
	PARAMETERS tcString
	LOCAL lcLetter, i, llRetVal
	lcLetter = LEFT( tcString, 1 )
	i = 0
	llRetVal = .T.

	FOR i = 2 TO LEN( tcString )
		IF SUBSTR( tcString, i, 1 ) <> lcLetter
			llRetVal = .F.
			EXIT
		ENDIF
		lcLetter = SUBSTR( tcString, i, 1 )
	ENDFOR

RETURN llRetVal
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform