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.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only