Login | |
|
 |
RE: Incrementing The AlphaNumeric - 10/24/2006 12:28:46 AM
|
|
 |
|
| |
TNO
Posts: 1247
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
Umm, not quite. Its alphanumeric not just Numeric What if it was numbers like the following? 1234 612A 99Z4 D001 etc... And any other random combination of 0-9 & A-Z, I'd like to be able to increment these numbers regardless of wether its Alpha or Numeric so: 1234 + 1 --> 1235 612A + 1 --> 612B 99Z4 + 1 --> 99Z5 D001 + 1 --> D002 And so on. I'm pretty certain that if the "number" was treated as a Base 36 number it would be possbile but I'm not sure what the vbscript equivalent of parseInt(numString, [radix]) is.
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: Incrementing The AlphaNumeric - 10/24/2006 1:00:49 AM
|
|
 |
|
| |
ebgreen
Posts: 4970
Score: 31
Joined: 7/12/2005
Status: offline
|
Nevermind. I'm not really awake yet. I actually read your post and realize that if it were base 36 then 123Z would become 1240. Then I assume that ZZZZ would become 0000. I'll ponder it. I'm sure it can be done it's just a matter of the best way.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Incrementing The AlphaNumeric - 10/24/2006 1:11:37 AM
|
|
 |
|
| |
TNO
Posts: 1247
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
it would become 124A the base consists of 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: Incrementing The AlphaNumeric - 10/24/2006 1:18:32 AM
|
|
 |
|
| |
TNO
Posts: 1247
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
What I'm thinking of is to convert base 36-->base 10, add 1, then convert back to base 36 for the result. Too bad the only functions available in vbscript are Hex and Oct
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: Incrementing The AlphaNumeric - 10/24/2006 1:21:38 AM
|
|
 |
|
| |
TNO
Posts: 1247
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
quote:
it would become 124A err...1240, I'm confusing myself with base 36 thinking
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: Incrementing The AlphaNumeric - 10/24/2006 2:32:22 AM
|
|
 |
|
| |
TNO
Posts: 1247
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
Looks like that will do it. You've just about inspired me to recreate a generic parseInt function for vbscript
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: Incrementing The AlphaNumeric - 10/24/2006 4:23:01 AM
|
|
 |
|
| |
ebgreen
Posts: 4970
Score: 31
Joined: 7/12/2005
Status: offline
|
Oooh...I like using the string for the values. Not so hip with treating it as a global rather than putting it in a function. Am I reading it wrong or will it only work for a 4 character string?
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Incrementing The AlphaNumeric - 10/24/2006 5:57:42 AM
|
|
 |
|
| |
mcds99
Posts: 433
Score: 4
Joined: 2/28/2006
Status: offline
|
This is not an answer to your question but a comment/question. Not fully understanding the math in this, it is amazing that I even understand some of it. Math not being my strongest suit in college, I made it through calculus and trigonometry, barley. I find it so much fun to at least try to figure out the how and why of the code. What is this used for? The reason I ask is when IPv6 lands this sort of scripting will be invaluable for DNS and DHCP administration.
_____________________________
Sam Keep it Simple Make it Fun KiSMiF
|
|
| |
|
|
|
 |
RE: Incrementing The AlphaNumeric - 10/24/2006 6:01:15 AM
|
|
 |
|
| |
ebgreen
Posts: 4970
Score: 31
Joined: 7/12/2005
Status: offline
|
I read this: quote:
Math not being my strongest suit in college, I made it through calculus and trigonometry, barley. And thought you only got through math by using lots of barley (mixed with hops of course).
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
|
|