comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <OneWingedShark@gmail.com>
Subject: Re: trimming strings
Date: Sun, 03 Aug 2014 18:17:28 -0600
Date: 2014-08-03T18:17:28-06:00	[thread overview]
Message-ID: <viADv.144678$Ro3.64590@fx13.iad> (raw)
In-Reply-To: <2satt9tc4b1c6ldmqnmec3181jnfsuj7hp@4ax.com>

On 03-Aug-14 15:42, agent@drrob1.com wrote:
> I also don't have string processing down.

Ah, here's the big secret to Ada string processing: treat them as arrays.

Make liberal use of things like 'First, 'Last, 'Length and don't assume 
your 'Fists = 1. Also, remember the difference between constrained and 
unconstrained --
  D : String;                    -- Unconstrained.
  E : String := "This."          -- Constrained by initialization.
  F : String(1..255);            -- Constrained by subtype.
  G : String := Fn(X);           -- Constrained by initialization.

  -- the last thing to remember is that strings are perfectly sized for 
their content. (This should be done at initialization.) TED explains it 
quite well here: http://stackoverflow.com/a/15104158/608963

  parent reply	other threads:[~2014-08-04  0:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-02 13:10 trimming strings agent
2014-08-02 14:21 ` Pascal Obry
2014-08-02 15:27   ` G.B.
2014-08-02 17:00     ` Adam Beneschan
2014-08-02 17:22 ` mockturtle
2014-08-03 21:42   ` agent
2014-08-03 23:14     ` Georg Bauhaus
2014-08-04  0:17     ` Shark8 [this message]
2014-08-04 10:06       ` mockturtle
2014-08-04 10:49         ` Pascal Obry
2014-08-04 11:51           ` Simon Clubley
2014-08-04 12:11             ` Pascal Obry
2014-08-04 16:50         ` Shark8
2014-08-04 23:28           ` Dennis Lee Bieber
2014-08-05 21:05             ` agent
replies disabled

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