Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Alphabetic numbering system
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00174074
Message ID:
00174169
Views:
28
>I just wanted to play along and wanted to submit a short function that I wrote in the past but had to find again... I know you have a solution but this one will work with whatever base length you want...
>
>The lcChrs string is the basis. First char allows for blanks (in case left side has preceeding spaces. Then the last char in the list is the one that will trigger rollover to process next character....
>
>You could even try calling with a sample loop and try with strings like
>
>lcChrs = " 0123456789ABCDEF"
>lcChrs = " ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789!@#$%^&*(){}"
>
>as long as there are no duplicate characters in the string but the first space is needed as starting point for possible blank values...
>
>
>function NextID
>   lparameters lcID
>   local lcChrs, lcNewID, lnLen, ln1, lnAt
>   lcChrs	= " ABCDEFGHIJKLMNOPQRSTUVWXYZ"
>   lcNewID	= ""
>   lnLen	= len( lcID )
>   for ln1 = lnLen to 1 step -1
>      lnAt = at( substr( lcID, ln1, 1 ), lcChrs )
>      if lnAt < len( lcChrs )
>         */ No more carrying needed... get remaining chars
>         */ not processed and add to chars already processed
>         lcNewID = left( lcID, lnLen - (lnLen -ln1) -1 );
>                 + substr( lcChrs, lnAt +1, 1 ) + lcNewID
>         exit
>      else
>         lcNewID = "A" + lcNewID
>      endif
>   endfor
>return( lcNewID )
>
>
oops... Forgot... If you do a different numbering scheme, the else should be

lcNewID = substr( lcChrs, 2, 1 ) + lcNewID
Previous
Reply
Map
View

Click here to load this message in the networking platform