From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,a7135c0f450945a5 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!newsfeed.straub-nv.de!news.albasani.net!not-for-mail From: Leslie Newsgroups: comp.lang.ada Subject: Re: How to convert a string containing two hex digits to a character? Date: Tue, 05 Jan 2010 18:43:41 -0600 Organization: albasani.net Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.albasani.net hOypWo2W23tywNc+64abJXGqi8DqtE1crk+DRmhDKRq5LcJq1AjC5uC5sEmV2dPPIcx+YAHG42705oPdrJmcfN91z0XJBgK+KvFUBs9AWtPEet8ZmJYgDGtqUF2og+q+ X-Complaints-To: abuse@albasani.net NNTP-Posting-Date: Wed, 6 Jan 2010 00:42:44 +0000 (UTC) X-User-ID: rxBVlFqThYm7j6wsCVNJ4aTiLo/JCO52P0M+dx9PUPAqRwatC1jATCXCzai6ZmLxErs0HfVTOTVuzNumZY5tbQ== Cancel-Lock: sha1:xp1ScBtlqmyptMa7QJSc+8NSCXE= User-Agent: KNode/0.10.9 X-NNTP-Posting-Host: s568WIFNpm6SSbaVtw3BDZcJ+vepZfBVGjpaaNroNBE= Xref: g2news1.google.com comp.lang.ada:8623 Date: 2010-01-05T18:43:41-06:00 List-Id: Leslie wrote: > Hi, it's me again. :-) > > I need to be able to convert a string variable > containing two > hexadecimal digits (e.g. "7C") to its equivalent character > value. I see from ARM 3.5.5 "Operations of Discrete Types" > that I can use > > function S'Val(Arg : universal_integer) return S'Base > > where universal_integer would be the numeric value of the > string, but how do I get from "7C" to 16#7C# when 7C is a > string value, > not a constant? I.e., > OOPS! Should be > Hex_Pair : unbounded_string; > Char_Code : character; -- moved this out of the block. :-) > > begin > Hex_Pair := slice(some_string,1,2); > -- now what? > end; > > Leslie