Link to home
Create AccountLog in
Avatar of Bob Schneider
Bob SchneiderFlag for United States of America

asked on

Subtraction v Hex2Dec in vbscript

Lets say I had to iterate through a loop of 1000 rows of a text file and at each row I had to take a value and do one of the following:
1) If the value were a decimal value with 6 digits, subtract 100,000 from the value
2) If the value were a hex value, convert it to decimal.

Which would be quicker/use fewer resources?

Thank you!
SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of Bob Schneider

ASKER

Thanks everyone.  Here is more information:  I time races 5k, marathon, trithlons, etc) and I encode my own RFID tags.  I have to make sure that there is little or no reasonable chance of conflicting with things like rfid tags that are put into shoes, etc.  However, ultimately I have to have decimal numbers to work with.  So the two options I have landed on are these:

1) I could encode the tags using 6 decimal digits (I have never seen a six-digit decimal rfid value come through my system).  For instance, rfid tag 100001 would be used for bib #1, rfid tag 100002 would go on bib #2, etc.  Then I just loop through and subtract 100000 from each tag before processing the results.

2) I could encode the tags using hex numbers and just convert to decimal prior to processing the results.

I prefer the first method because it is human-readable but it is even more important to process quickly.

Thanks for any additional clarity you can provide.  I will look at the above links, code, suggestions, ...
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.