Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Incrementing Alpha ID's
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01212864
Message ID:
01212978
Vues:
22
More like this:
*
** AlphaID Incrementer
*
FUNCTION AlphaIDIncrementer
LPARAMETERS cAlphaID
LOCAL nIndex,nIDLEngth,cCharToIncrement
nIDLength = LEN(cAlphaID)
FOR nIndex = 1 TO nIDLength
cCharToIncrement=SUBSTR(cAlphaID,nIDLength-nIndex+1,1)
cCharToIncrement=CHR(ASC(cCharToIncrement)+1)
IF cCharToIncrement > "z"
cCharToIncrement = "a"
STUFF(cAlphaID,nIDLength-nIndex+1,1,cCharToIncrement)
ELSE
STUFF(cAlphaID,nIDLength-nIndex+1,1,cCharToIncrement)
EXIT
ENDIF
ENDFOR
IF nIndex > nIDLength
RETURN .F. && Overflow
ENDIF
RETURN cAlphaID

Note: alphaID must not be mixed case, it must be either upper or lower case. Also must be characters a-z.

>So, is that something like the following?
>
>lcID="aaaaa"
>lnID=ASC(lcID) + 1
>
>>You just increment it by 1 , each time. When it becomes greater than a "z" you set it back to an "a" and increment the character to the left.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform