A few suggestions: Instead of looping to find the end of the string, use the "Index" function from Ada.Strings.Fixed on a slice of the original string instead of your own loop. Something like: Delete_Stop := Ada.Strings.Fixed.Index( Source => Msg( Delete_Start .. Msg_Length ) ... If Delete_Stop = 0 Then Delete_Stop := Msg_Length; Else Delete_stop := Delete_Stop - 1; End If; Then use Ada.Strings.Fixed.Replace_Slice to replace the string between Delete_Start and Delete_Stop. If I were writing the code I would probably use Ada.Strings.Bounded instead of passing around fixed sized strings separate from the length, then use the corresponding Index and Replace_Slice functions from Ada.Strings.Bounded. Using bounded strings has the advantage that the library does the work of maintaining string lengths for you. That is: Package Callsign_String_Package is new Ada.Strings.Bounded.Generic_Bounded_Length( C_Max_Msg_Size ); subtype T_Msg_Data_Str is Callsign_String_Package.Bounded_String; etc Steve (The Duck) BTW: I find your naming conventions awkward... personal preferance. "Frode Tenneboe" wrote in message news:1049198066.356477@edh3... > > I have a small-ish procedure which only purpose is to take a > formatted string (see example) and replace the callsign(s) > inside with another. > > The strings look like: > > "ME000=F012;ME001=AAA,BBB,CCC;ME002=FOO...." > > I would like to replace "ME001=AAA,BBB,CCC" with "ME001=AAA". The > procedure below does just that. However, looking at the code, I don't > like the lumpyness (in lack of a better word). There must be a > more elegant way of doing this? Any ideas? > [snip] > > -Frode > > -- > ^ Frode Tenneb� | email: Frode.Tennebo@eto.ericsson.se ^ > | Ericsson AS., N-1788 Halden | Phone: +47 67 25 09 39 | > | with Standard.Disclaimer; use Standard.Disclaimer; |