comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Optimising string handling in application
Date: Fri, 04 Apr 2003 17:43:57 GMT
Date: 2003-04-04T17:43:57+00:00	[thread overview]
Message-ID: <xvjja.366865$sf5.696821@rwcrnsc52.ops.asp.att.net> (raw)
In-Reply-To: 1049451208.932382@edh3

> However, sometimes I miss the expressionness of perl:
>
> s/([^;]*;ME001=)([^;]*)(;[^;]*)/$1$callsign$3/;

What does that do if "ME001=" or the ';' aren't present?

What does "expressionness" mean?  Does:

function Replace_Callsign_In_Message(M, C : String) return String is
  use Ada.Strings.Fixed;
  Eq : constant Positive := Index(M, "ME001=")+5;
begin
  return M(M'first .. Eq) & C & M(Index(M(Eq .. M'last),";') .. M'last);
end Replace_Callsign_In_Message;

have more or less of it than:

function Replace_Callsign_In_Message(Msg, New_Callsign : String) return String is
  use Ada.Strings.Fixed;
  Eq : constant Positive := Index(Msg, "ME001=")+5;
  Semi : Natural;
begin
  if Eq = 5 then raise Constraint_Error;end if; -- missing "ME001="
  Semi := Index(Msg, ";");
  if Semi = 0 then raise Constraint_Error;end if; -- missing ";"
  return Msg(Msg'first .. Eq)
         & New_Callsign
         & Msg(Semi .. Msg'last);
end Replace_Callsign_In_Message;



  parent reply	other threads:[~2003-04-04 17:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-01 11:54 Optimising string handling in application Frode Tenneboe
2003-04-01 18:52 ` Jeffrey Carter
2003-04-02  3:17 ` Steve
2003-04-02  4:10 ` tmoran
2003-04-02  7:15   ` Frode Tenneboe
2003-04-02 18:23     ` tmoran
2003-04-04 10:13       ` Frode Tenneboe
2003-04-04 13:26         ` Preben Randhol
2003-04-04 14:42           ` Frode Tenneboe
2003-04-04 21:48             ` Warren W. Gay VE3WWG
2003-04-05  7:24               ` Pascal Obry
2003-04-04 14:08         ` Frank J. Lhota
2003-04-04 15:26           ` Robert Spooner
2003-04-04 21:49             ` Warren W. Gay VE3WWG
2003-04-04 17:43         ` tmoran [this message]
2003-04-04 21:42           ` Frode Tennebø
2003-04-02 19:03     ` tmoran
2003-04-04 10:44       ` Frode Tenneboe
2003-04-05  3:28         ` tmoran
2003-04-05  0:08     ` Jeffrey Carter
replies disabled

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