We help IT Professionals succeed at work.

Subtraction v Hex2Dec in vbscript

Bob Schneider
on
243 Views
Last Modified: 2017-03-29
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!
Comment
Watch Question

Martin LissProtect yourself and your loved ones. Stay home for the holidays.
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Bill PrewTest your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Top Expert 2016
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Bill PrewTest your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Top Expert 2016
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Bill PrewTest your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Top Expert 2016
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Bob SchneiderCo-Owner

Author

Commented:
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, ...
Test your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Top Expert 2016
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions