From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Convert a Wide_String (or a Wide_Character) to an Integer.
Date: Tue, 10 Feb 2015 14:38:24 -0700
Date: 2015-02-10T14:38:24-07:00 [thread overview]
Message-ID: <mbdtnc$h0h$1@dont-email.me> (raw)
In-Reply-To: <19fa66d7-91ac-4196-9c8f-c633950b9e39@googlegroups.com>
On 02/10/2015 02:16 PM, lomoscompany@gmail.com wrote:
> Why does it have to be so damn complicated?
It isn't.
> How does one convert a Wide_String into a normal String? Or, in my case, a Wide_Character to a Character.
The package Ada.Characters.Conversions defines functions To_Character, which
convert a [Wide_]Wide_Character to Character. There are also similar To_String
functions. See ARM A.3.4:
http://www.adaic.org/resources/add_content/standards/12rm/html/RM-A-3-4.html
Anyone using Ada should be familiar with the contents of ARM Annex A, which
defines the standard library.
> -- NEED TO RETURN AN INTEGER CREATED FROM A SINGLE CHARACTER IN A WIDE
> -- STRING HERE
To convert a single character to an integer value presumes that the character is
a digit. That can be converted more simply with
Character'Pos (Char) - Character'Pos ('0')
Presuming that the digits are contiguous beginning with '0' for Wide_Character,
this would work with Wide_Character'Pos as well.
--
Jeff Carter
"Spam! Spam! Spam! Spam! Spam! Spam! Spam! Spam!"
Monty Python's Flying Circus
53
next prev parent reply other threads:[~2015-02-10 21:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-10 21:16 Convert a Wide_String (or a Wide_Character) to an Integer lomoscompany
2015-02-10 21:38 ` Jeffrey Carter [this message]
2015-02-10 21:51 ` Randy Brukardt
2015-02-10 22:38 ` lomoscompany
2015-02-11 1:18 ` David Botton
2015-02-11 21:59 ` lomoscompany
2015-02-11 22:05 ` David Botton
2015-02-12 20:09 ` Randy Brukardt
2015-02-13 22:11 ` lomoscompany
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox