comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <sparre@nbi.dk>
Subject: Re: Can I convert a string of letters into an array?
Date: Wed, 07 Mar 2012 11:39:52 +0100
Date: 2012-03-07T11:39:52+01:00	[thread overview]
Message-ID: <878vjcheyv.fsf@adaheads.sparre-andersen.dk> (raw)
In-Reply-To: zLednfMxUtyBtsvSnZ2dnUVZ_oSdnZ2d@earthlink.com

Dennis Lee Bieber wrote:

> 	That's all? Given the specifications you don't even need to
> "rearrange" the contents. All you need is the total length, and a pass
> over the string to count how many "B"s appear in it. That gives you
> the information of how many "G"s are in it (since the spec says you
> don't have to worry about any other characters). Given m-B, n-G, a
> moderately simple loop can be used to emit alternating BG pairs until
> the shorter one has expired, then just emit enough of the remaining
> letter to fill out the required length.

Why not just use Ada.Strings.Fixed.Count and Ada.Strings.Fixed."*".

Jacob
-- 
"Those who will not reason, are bigots,
 those who cannot, are fools, and
 those who dare not, are slaves."



      parent reply	other threads:[~2012-03-07 10:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-06  1:46 Can I convert a string of letters into an array? Will
2012-03-06  2:22 ` Shark8
2012-03-06  2:58 ` Jeffrey Carter
2012-03-06  3:10   ` Will
2012-03-06  4:51     ` John B. Matthews
2012-03-06  5:00       ` John B. Matthews
2012-03-06  6:29     ` Jeffrey Carter
2012-03-06  7:51       ` anon
2012-03-08  9:48     ` tonyg
2012-03-08 11:30       ` Simon Wright
2012-03-08 13:06         ` mockturtle
2012-03-08 14:04           ` Simon Wright
2012-03-06  3:13 ` Will
2012-03-06  8:29   ` Ludovic Brenta
     [not found]   ` <zLednfMxUtyBtsvSnZ2dnUVZ_oSdnZ2d@earthlink.com>
2012-03-07 10:39     ` Jacob Sparre Andersen [this message]
replies disabled

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