From: Erich <john@peppermind.com>
Subject: Re: Convert wide_string to string (as the same byte array)
Date: Fri, 24 Feb 2012 14:58:26 -0800 (PST)
Date: 2012-02-24T14:58:26-08:00 [thread overview]
Message-ID: <ef10fb5a-70cd-4767-809c-77ca2c7dc4da@k40g2000yqf.googlegroups.com> (raw)
In-Reply-To: 9b005a0a-989a-4c00-8d8e-6f93fa1cf9e3@kh11g2000pbb.googlegroups.com
> You'll probably want something like this, for each Wide_Character,
> where S is the String and WS is the Wide_String:
<snip>
Thanks a lot! Seems to work fine.
function To_String (WS : Wide_String) return String is
S : String (1 .. WS'Length*2);
J : Positive;
begin
J := 1;
for I in WS'Range loop
S (J) := Character'Val (Wide_Character'Pos (WS (I)) /
256);
S (J + 1) := Character'Val (Wide_Character'Pos (WS (I)) mod
256);
J := J + 2;
end loop;
return S;
end To_String;
Best,
Erich
next prev parent reply other threads:[~2012-02-24 22:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-24 22:01 Convert wide_string to string (as the same byte array) Erich
2012-02-24 22:25 ` Adam Beneschan
2012-02-24 22:58 ` Erich [this message]
2012-03-06 1:58 ` Randy Brukardt
2012-03-06 15:54 ` Adam Beneschan
2012-03-07 1:04 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox