From: "Arie van Wingerden" <xapwing@gmail.com>
Subject: Re: Question on bounded / unbounded strings
Date: Wed, 14 Sep 2016 13:23:33 +0200
Date: 2016-09-14T13:23:33+02:00 [thread overview]
Message-ID: <nnd$203d181d$42474a5a@a382b8e07527efd7> (raw)
In-Reply-To: <nnd$12b05e33$1843543e@b46552de0b4781f4>
Hi,
thank you *very* much. You are very helpful!
I created the following program, which only uses standard strings. It works
partly.
There is one thing I cannot get to work properly:
in the FOR loop the statement:
ATIO.Put(Path(Start .. Len));
outputs the first part of Path properly; but in the following cases it
won't.
What am I doing wrong?
(Don't mind the matching; this is NOT correct currently).
(Wrongly indented pieces will be gone in final version.)
The program code (FIP stand for Find In Path):
======================================
with Ada.Text_Io;
with Ada.Integer_Text_Io;
with Ada.Environment_Variables;
with Ada.Strings.Fixed;
with Ada.Strings.Maps.Constants;
procedure Fip is
package ATIO renames Ada.Text_IO;
package AITIO renames Ada.Integer_Text_Io;
package AEV renames Ada.Environment_Variables;
package ASF renames Ada.Strings.Fixed;
package ASMC renames Ada.Strings.Maps.Constants;
Path : string := ASF.Translate(AEV.Value("Path"),
ASMC.Lower_Case_Map);
Match : string := ASF.Translate(ATIO.Get_Line, ASMC.Lower_Case_Map);
procedure Match_Path (Match : in string; Path : in string) is
Start : positive := 1;
Len : natural := 0;
begin
for I in Path'Range loop
if Path(I) = ';' then
ATIO.Put_Line("----------------------------------------------------");
ATIO.Put(Path(Start .. Len)); AITIO.Put(Start); AITIO.Put(Len); ATIO.Put("
"); ATIO.Put_Line(Match);
-- This matching part is not OK yet
if Len > 0 and then Path(Start .. Len) = Match then
ATIO.Put_Line(Path(Start .. Len));
end if;
Start := I + 1;
Len := 0;
else
Len := Len + 1;
end if;
end loop;
end Match_Path;
begin
Match_Path(Match, Path);
ATIO.Flush;
end Fip;
next prev parent reply other threads:[~2016-09-14 11:23 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-13 8:46 Question on bounded / unbounded strings Arie van Wingerden
2016-09-13 9:04 ` Dmitry A. Kazakov
2016-09-22 2:10 ` John Smith
2016-09-22 7:24 ` Dmitry A. Kazakov
2016-09-22 9:01 ` J-P. Rosen
2016-09-22 9:53 ` Dmitry A. Kazakov
2016-09-22 10:58 ` G.B.
2016-09-22 12:05 ` Dmitry A. Kazakov
2016-09-22 14:14 ` G.B.
2016-09-22 17:18 ` Dmitry A. Kazakov
2016-09-22 11:08 ` J-P. Rosen
2016-09-22 12:05 ` Dmitry A. Kazakov
2016-09-22 13:18 ` Maciej Sobczak
2016-09-22 13:52 ` Dmitry A. Kazakov
2016-09-22 14:51 ` Maciej Sobczak
2016-09-22 17:13 ` Dmitry A. Kazakov
2016-09-23 5:50 ` Maciej Sobczak
2016-09-23 6:36 ` Simon Wright
2016-09-23 7:48 ` Dmitry A. Kazakov
2016-09-28 20:55 ` Randy Brukardt
2016-09-23 23:58 ` John Smith
2016-09-24 7:52 ` Dmitry A. Kazakov
2016-09-24 16:25 ` John Smith
2016-09-24 17:44 ` Dmitry A. Kazakov
2016-09-24 18:33 ` John Smith
2016-09-24 18:37 ` John Smith
2016-09-24 18:59 ` John Smith
2016-09-25 8:50 ` Dmitry A. Kazakov
2016-09-25 23:35 ` brbarkstrom
2016-09-26 7:28 ` Dmitry A. Kazakov
2016-09-26 12:39 ` brbarkstrom
2016-09-28 21:09 ` Randy Brukardt
2016-09-30 7:59 ` Björn Lundin
2016-09-13 9:35 ` gautier_niouzes
2016-09-13 10:41 ` Alejandro R. Mosteo
2016-09-13 17:41 ` Jeffrey R. Carter
2016-09-13 17:59 ` Björn Lundin
2016-09-14 11:23 ` Arie van Wingerden [this message]
2016-09-14 12:26 ` Arie van Wingerden
2016-09-14 12:28 ` Arie van Wingerden
2016-09-14 12:57 ` Arie van Wingerden
2016-09-14 19:39 ` Jeffrey R. Carter
2016-09-17 16:35 ` Arie van Wingerden
2016-09-16 14:43 ` Olivier Henley
2016-09-17 16:35 ` Arie van Wingerden
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox