Jump to content
YOUR-AD-HERE
HOSTING
TOOLS
992Proxy

Locked Increment a Text String (from ABY to ABZ to AZA etc.)


Kaway

Recommended Posts

[HIDE-THANKS]It is sometimes desirable to generate a string analogous to the autonumber, that is, to have a way of "incrementing" a text string. This might be useful if, for instance, you have a database field that (a) is textual, (b) has to be unique, and © has to be generated programmatically as you add a new record. The following function accepts a string and returns the one that "comes next", as is illustrated in the following table:

If you pass in The function will return

ABC ABD

ABY ABZ

ABZ ACA

AZZ BAA

ZZZ AAAA

In other words, it will work just as you would expect it to for a numeric argument, incrementing the last position if possible or resetting it to A and incrementing the one to its left. The suggested function is case-insensitive; it will preserve the case used in the original string.

 

Sample use:

 

Text1.text = IncrementTextString(Text1.text)

 

 

This is the hidden content, please

[/HIDE-THANKS]

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.