comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: span string.
Date: Sat, 23 Apr 2005 04:10:30 GMT
Date: 2005-04-23T04:10:30+00:00	[thread overview]
Message-ID: <WUjae.12283$lP1.4807@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <d4bb48$1ocp$1@node2.news.atman.pl>

Doker wrote:

> I have string like that "abc1020"
> haw can i make it a string of fixed lenght of 10 chars like "   abc1020"?
> "abc" => "       abc" "4" => "         4"
> "1234567uui" => "1234567uui"

subtype String_10 is String (1 .. 10);

function To_10 (S : String) return String_10 is
    -- null;
begin -- To_10
    if S'Length >= 10 then
       return S (S'First .. S'First + 9);
    else
       return String'(1 .. 10 - S'Length => ' ') & S;
    end if;
end To_10;

-- 
Jeff Carter
"Every sperm is sacred."
Monty Python's the Meaning of Life
55



  parent reply	other threads:[~2005-04-23  4:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-22 17:18 span string Doker
2005-04-22 18:44 ` Marc A. Criley
2005-04-22 20:31   ` Doker
2005-04-22 23:45     ` Marius Amado Alves
2005-04-23  6:39     ` Martin Krischik
2005-04-23 15:43       ` Steve
2005-04-23 19:59         ` Martin Krischik
2005-04-24 13:01         ` Stephen Leake
2005-04-25 14:02     ` Peter Hermann
2005-04-23  4:10 ` Jeffrey Carter [this message]
2005-04-23 14:14 ` Doker
replies disabled

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