Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Alphabetic numbering system
Message
From
08/01/1999 13:36:45
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00174074
Message ID:
00174127
Views:
27
Hiya George ---

Nyah, nyah....beat ya ... got it in 16 lines ;-D

>
>Since everyone seems to be joining the fun, I can't resist a problem like this. Whaddya think of:
>* FUNCTION IncrChar
>* AUTHOR: George Tasker
>* DATE: January 8, 1999 - 1:26 PM
>* PURPOSE:
>
>LPARAMETER pcChars
>
>LOCAL lcresult, lcrightmost, lcbase, lnlength
>lnlength = LEN(pcChars)
>lcrightmost = CHR(ASC(RIGHT(pcChars, 1)) + 1)
>IF lnlength > 1
>  lcbase = LEFT(pcChars, LEN(pcChars) - 1)
>  IF lcrightmost > "Z"
>    lcresult = IncrChar(lcbase) + "A"
>  ELSE
>    lcresult = lcbase + lcrightmost
>  ENDIF
>ELSE
>  IF lcrightmost > "Z"
>    lcresult = "AA"
>  ELSE
>    lcresult = lcrightmost
>  ENDIF
>ENDIF
>RETURN lcresult
>No loops, no muss, no fuss. It'll automatically icrease the length by one when it gets to "ZZZZ" or the like.
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform