From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,992e84f408e149d8 X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: How to initiate part of a string? Date: 1998/08/26 Message-ID: #1/1 X-Deja-AN: 384959489 References: <35E171AB.75CD@ddre.dk> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.ada Date: 1998-08-26T00:00:00+00:00 List-Id: In article 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...