× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Booth -

My need is to find each of these block's numerical value.   I am finding
this extremely confusing for me as the field can vary from 5 to 11
characters long.

I would use a finite state machine for parsing the data. That can validate as well as parse.


After that, I need to convert the number to its hex equivalent.

Do you want to convert it to the actual hex value or to the character equivalent of the value? I.e. would 000 convert to x'00' or x'F0F0'?


If the actual hex value, you can use eight IFs with bit operations to do it.

If the character equivalent, the easiest way would be to have a compile-time array with 256 elements loaded with the character equivalents. The numeric value + 1 would point to the proper element.

Ken
http://www.ke9nr.net/
Opinions expressed are my own and do not necessarily represent the views of my employer or anyone in their right mind.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.