comp.lang.ada
 help / color / mirror / Atom feed
* How to convert a string containing two hex digits to a character?
@ 2010-01-06  0:39 Leslie
  2010-01-06  0:43 ` Leslie
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Leslie @ 2010-01-06  0:39 UTC (permalink / raw)


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.,

  Hex_Pair : unbounded_string;

  begin
    Hex_Pair := slice(some_string,1,2);
    Char_Code : character;
    -- now what?
  end;

Leslie



^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2010-01-15 22:06 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-06  0:39 How to convert a string containing two hex digits to a character? Leslie
2010-01-06  0:43 ` Leslie
2010-01-06  1:22   ` Hibou57 (Yannick Duchêne)
2010-01-06  1:31     ` Hibou57 (Yannick Duchêne)
2010-01-06  2:05       ` Leslie
2010-01-06  2:39     ` Leslie
2010-01-06  2:42       ` Leslie
2010-01-06 21:54     ` Maciej Sobczak
2010-01-06 22:19       ` Hibou57 (Yannick Duchêne)
2010-01-09 10:50         ` Hibou57 (Yannick Duchêne)
2010-01-09 11:13           ` Hibou57 (Yannick Duchêne)
2010-01-09 11:33             ` Dmitry A. Kazakov
2010-01-09 14:50               ` Hibou57 (Yannick Duchêne)
2010-01-09 16:04                 ` Dmitry A. Kazakov
2010-01-11 15:53                   ` Adam Beneschan
2010-01-11 18:13                     ` Dmitry A. Kazakov
2010-01-15 19:59                     ` Hibou57 (Yannick Duchêne)
2010-01-15 22:06                       ` John B. Matthews
2010-01-06  5:17 ` tmoran
2010-01-06 22:19   ` Leslie
2010-01-06 22:22   ` Hibou57 (Yannick Duchêne)
2010-01-07 14:26 ` John B. Matthews

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox