comp.lang.ada
 help / color / mirror / Atom feed
From: Jim Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: String slicing.
Date: Sun, 17 Mar 2002 22:43:57 GMT
Date: 2002-03-17T22:43:57+00:00	[thread overview]
Message-ID: <3C951C26.6050706@worldnet.att.net> (raw)
In-Reply-To: AH8l8.64181$uA5.64687@rwcrnsc51.ops.asp.att.net

The compiler is correct here. The index subtype for strings is
Positive. A character is not a member of the Positive subtype.

My guess from your description is that you want the
capabilities defined in the package Ada.Strings.Fixed.
This package will help you scan a string by words.

Jim Rogers

Wannabe h4x0r wrote:

> I've written a type definition as follows...
> 
> 	type wrd_string is new String(1..Ada.Characters.Latin_1.Space);
> 
> Now it says that I'm using incompatible types. Now, shouldn't the
> compiler be smart enough to recognize that I'm using Characters to count
> the characters of an array slice. i.e. a String is nothing more than an
> array of characters.
> 
> Basically I'm breaking down a text file into chunks of "words" and
> "sentences" for sorting by Mats Webers "quick_sort" routine in his
> components library. Or rather, I'm learning how to. I can sort by
> character easily enough, now I'm learning to work with slices of Strings.
> 
> This is a general pain in the ass for me, as it seems Ada wont let me
> slice and reference pieces of strings using Characters. Dont worry, I am
> reading the manual. Any tips or pointers would be helpful.
> 
> Chris
> 




  reply	other threads:[~2002-03-17 22:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-17 22:23 String slicing Wannabe h4x0r
2002-03-17 22:43 ` Jim Rogers [this message]
2002-03-17 23:53   ` Wannabe h4x0r
2002-03-18 12:44 ` sk
2002-03-19  2:36   ` Wannabe h4x0r
2002-03-18 17:49 ` Georg Bauhaus
replies disabled

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