comp.lang.ada
 help / color / mirror / Atom feed
From: "Rego, P." <pvrego@gmail.com>
Subject: Re: AVR Usart send number string with no 'Image
Date: Wed, 1 May 2013 13:35:02 -0700 (PDT)
Date: 2013-05-01T13:35:02-07:00	[thread overview]
Message-ID: <443a92d3-2327-423d-ad74-174b0a69e4c4@googlegroups.com> (raw)
In-Reply-To: <931385b2-3520-4d7a-b56f-6d0d0b06d467@googlegroups.com>

Now I am trying to implement the inverse (String to Unsigned_8), but something is missing...

I tried

   function String_To_Unsigned_8 (Input : String) return Unsigned_8 is
      Result : Unsigned_8 := 0;
   begin
      for Digit in Input'Range loop
         Result := 10*Result + (Character'Pos (Input (Digit)) - Character'Pos ('0'));
      end loop;
         
      return Result;
   end String_To_Unsigned_8;

But the result is not right. Maybe did I forget something?



  parent reply	other threads:[~2013-05-01 20:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-25  1:27 AVR Usart send number string with no 'Image Rego, P.
2013-04-25  2:03 ` Shark8
2013-04-25 10:55   ` Rego, P.
2013-04-26  2:28     ` Rego, P.
2013-04-26  5:50       ` Simon Wright
2013-04-30  2:58         ` Rego, P.
2013-04-26 14:52       ` Shark8
2013-04-26 21:10         ` Shark8
2013-04-30  3:00           ` Rego, P.
2013-04-25  4:54 ` rrr.eee.27
2013-04-25 10:58   ` Rego, P.
2013-05-01 20:35 ` Rego, P. [this message]
2013-05-01 21:00   ` Simon Wright
2013-05-01 22:07     ` Rego, P.
2013-05-01 22:30       ` Jeffrey Carter
2013-05-01 22:46         ` Rego, P.
2013-05-01 23:29       ` Dennis Lee Bieber
2013-05-01 22:32   ` Shark8
2013-05-01 23:00     ` Rego, P.
2013-05-01 23:09       ` Shark8
replies disabled

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