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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,789b3fa522bdcc2a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-01 20:11:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn12feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!sccrnsc01.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Optimising string handling in application References: <1049198066.356477@edh3> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1049256658 12.234.13.56 (Wed, 02 Apr 2003 04:10:58 GMT) NNTP-Posting-Date: Wed, 02 Apr 2003 04:10:58 GMT Organization: AT&T Broadband Date: Wed, 02 Apr 2003 04:10:59 GMT Xref: archiver1.google.com comp.lang.ada:35877 Date: 2003-04-02T04:10:59+00:00 List-Id: Does this (with its questions answered) do what you want? function Replace_Callsign_In_Msg(Msg : in String; New_Callsign : in String) return String is Eq : constant Positive := Ada.Strings.Fixed.Index(Msg, "ME001=") + 5; Semi : Natural; begin if Eq = 5 then -- "ME001=" not present, what to do? end if; Semi := Ada.Strings.Fixed(Msg(Eq, ";"); if Semi = 0 then -- following ';' missing, what to do? end if; return Msg(Msg'first .. Eq) & New_Callsign & Msg(Semi .. Msg'last); end Replace_Callsign_In_Msg;