Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Random Generator
Message
De
23/01/2001 11:33:18
 
 
À
22/01/2001 23:19:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00467103
Message ID:
00467364
Vues:
13
>Sorry, here is the problem revised. It is to be a random character string, and it is based on the 35 characters 1-9, A-Z Uppercase only. So, can VFP do a random string generation?

While the others have given you a solution that works, what happens if you want to exclude some characters from the string, like the letter I and the number 1, letter S, and the number 5, etc., because they are too similar in appearance?

What you could do then is generate your random number 1-35 as they have done, but pull the actual character out of a source string with the valid characters in it.

lcValid = "ABCDEF...."
lcChar = SUBSTR(lcValid,randomval,1)

This would also allow you to vary the order you've specified for the valid characters and also to specify non-contiguous ranges of values for the characters.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform