comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: How to initiate part of a string?
Date: 1998/08/26
Date: 1998-08-26T00:00:00+00:00	[thread overview]
Message-ID: <EACHUS.98Aug26121958@spectre.mitre.org> (raw)
In-Reply-To: slrn6u7ah3.9v3.franke@paxp01.mipool.uni-jena.de

In article <slrn6u7ah3.9v3.franke@paxp01.mipool.uni-jena.de> franke@minet.uni-jena.de (Frank Ecke) writes:

 > After with'ing and use'ing Ada.Strings and Ada.Strings.Fixed,

 >    Txt : String(1 .. 100) := Replace_Slice(100 * Space, 50, 54, "Hello");

 > should do the trick.

   This will work, but Replace_Slice does more than intended, which is
why I recommend Overwrite.  (It is also likely that Overwrite will be
faster.)  Overwrite returns a string of the same length as the first
argument, but in Replace_Slice, the slice replaced does not need to be
the same length as the last argument. For example, 

   Txt : String(1 .. 100) := Replace_Slice(95 * Space, 50, 0, "Hello");

   will return the same string. And:

   Replace_Slice("Robert I. Eachus", 8, 9, "Iredell") replaces my
middle initial with my middle name.
--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




      reply	other threads:[~1998-08-26  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-24  0:00 How to initiate part of a string? Hans Marqvardsen
1998-08-25  0:00 ` Tom Moran
1998-08-25  0:00   ` Samuel Tardieu
1998-08-26  0:00     ` Tom Moran
1998-08-26  0:00       ` Robert I. Eachus
1998-08-26  0:00         ` Tom Moran
1998-09-24  0:00           ` Bob Fletcher
1998-09-24  0:00             ` Tom Moran
1998-09-25  0:00               ` dewarr
1998-09-29  0:00                 ` Aidan Skinner
1998-09-19  0:00       ` dewarr
1998-08-25  0:00 ` Mark A Biggar
1998-08-26  0:00 ` Mats Weber
1998-08-26  0:00   ` Frank Ecke
1998-08-26  0:00 ` Frank Ecke
1998-08-26  0:00   ` Robert I. Eachus [this message]
replies disabled

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