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,FORGED_GMAIL_RCVD, FREEMAIL_FROM,STOX_REPLY_TYPE,STOX_REPLY_TYPE_WITHOUT_QUOTES,XPRIO autolearn=no autolearn_force=no version=3.4.4 From: "Arie van Wingerden" Newsgroups: comp.lang.ada Subject: Question on bounded / unbounded strings Date: Tue, 13 Sep 2016 10:46:55 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 16.4.3528.331 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331 Message-ID: Organization: Powered by cheapnews.eu Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!feed.abavia.com!fbe002.abavia.com!abp002.abavia.com!news.cheapnews.eu!not-for-mail Injection-Date: Tue, 13 Sep 2016 10:46:56 +0200 Injection-Info: news.cheapnews.eu; mail-complaints-to="abuse@cheapnews.eu" Xref: news.eternal-september.org comp.lang.ada:31764 Date: 2016-09-13T10:46:55+02:00 List-Id: Hi, for a long time I've been interested in Ada but hadn't played with it. Now I bit the bullet and I am trying to create a small (Windows) program that: 1) reads a string from STDIN (yet to do) 2) fetches the contents of the PATH environment variable (done) 3) splits that content in individual paths (???) 4) tries to match the inputted string with part of each path (to do) 5) outputs only the matched paths (to do) I found out the hard way that Ada is very strict about bounded versus unbounded strings. So I had to convert the output of 2) to an unbounded string, because I could not know it's length in advance. Now I am a bit stuck splitting the string of paths; I use GNAT.String_Split.Create, but it needs a (bounded) String as input. However, I only have an unbounded string. QUESTION: How can I convert an unbounded string to a standard (bounded) string? A standard string must be defined with a fixed length in advance, which I do not know at the time ... TIA, Arie