From: Simon Wright <simon@pushface.org>
Subject: Re: AVR Usart send number string with no 'Image
Date: Wed, 01 May 2013 22:00:41 +0100
Date: 2013-05-01T22:00:41+01:00 [thread overview]
Message-ID: <lyip32quti.fsf@pushface.org> (raw)
In-Reply-To: 443a92d3-2327-423d-ad74-174b0a69e4c4@googlegroups.com
"Rego, P." <pvrego@gmail.com> writes:
> 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?
Do you have any white space in Input?
next prev parent reply other threads:[~2013-05-01 21:00 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.
2013-05-01 21:00 ` Simon Wright [this message]
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