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!feeder.news-service.com!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: Wed, 06 Jan 2010 16:19:35 -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 ijZCPuGUD0y8R6aI0BGjWX5dt9bB4FQrkkalTYNQk3jCgM7oN1khpYb1HtKu0M3TRKS+rsaud5Uxd4dCcMd1tmtF6x9IdLwJ5Uc5whhCCTrkhuNMWKoZFFnmkRKUEvY0 X-Complaints-To: abuse@albasani.net NNTP-Posting-Date: Wed, 6 Jan 2010 22:18:37 +0000 (UTC) X-User-ID: MIxFbkgWYIiQuri/NPnxjTKqAqapN+/vUdmbtWdj1eRfnnIiYAdW5jPDaWZ5CYSV+VmiFBgJsXCFoM9Z5SgM6w== Cancel-Lock: sha1:GPk3Vy2aX13ar+ke3LZPsxQECDc= User-Agent: KNode/0.10.9 X-NNTP-Posting-Host: y96SHsB7jby5u3eQEw//fRqQjzX1nkpzhBntGRltgdk= Xref: g2news1.google.com comp.lang.ada:8639 Date: 2010-01-06T16:19:35-06:00 List-Id: tmoran@acm.org wrote: > Hex_Pair : String(1 .. 2) := "7C"; > > Char : Character > := Character'val(Integer'value("16#" & Hex_Pair & "#")); > > Of course if this is homework in an Intro to Ada class, the > teacher may not believe you came up with this by yourself. No, this is not for school. :-) After 30 years of COBOL and REXX, I'm trying to teach myself Ada, which I'm finding a lot more understandable than C, especially for text manipulation. Thanks very much for this elegant solution; text handling seems to be a somewhat neglected subject in the Ada books and web sites I've been reading. Leslie