comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin David Condic, 561.796.8997, M/S 731-96" <condicma@PWFL.COM>
Subject: Re: Help me parse a long character
Date: 1997/11/03
Date: 1997-11-03T00:00:00+00:00	[thread overview]
Message-ID: <97110312041905@psavax.pwfl.com> (raw)


DHBemis <dhbemis@AOL.COM> writes:
>This is an easy one I'm sure. I'm in my first semester of programming....
>
>I'm trying to parse a 40-character long string. They are formatted in the
> following way:
>
>LASTNAME^^^^^^^^^^^^^^^^^FIRSTNAME^^^^^^      <--- the variable Full_Name
>
>I'm not sure how to parse it into to two separate variables, first_name and
> Last_name.
>
>I used the get_line procedure to get the string, so I have the last_character
> position. How do I ignore the spaces in between?
>
    Without writing the code for you...

    You might try declaring a three-state enumeration type (last_name,
    intermediate_spaces, first_name) and declaring a variable of that
    type that starts out at "last_name" As your loop scans the array,
    it looks for spaces to change to the middle state and non-spaces
    to change to the last state. The state tells you where to store
    the characters.

    If you don't yet know about enumeration types, try a counter with
    values of "1" "2" and "3" - same thing.

    MDC

Marin David Condic, Senior Computer Engineer     Voice:     561.796.8997
Pratt & Whitney GESP, M/S 731-96, P.O.B. 109600  Fax:       561.796.4669
West Palm Beach, FL, 33410-9600                  Internet:  CONDICMA@PWFL.COM
===============================================================================
    "Having an open mind is nothing. The object of opening the mind, as
    of opening the mouth, is to shut it again on something solid."
        --  G.K. Chesterton
===============================================================================




             reply	other threads:[~1997-11-03  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-03  0:00 Marin David Condic, 561.796.8997, M/S 731-96 [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-11-03  0:00 Help me parse a long character Simon Johnston
1997-11-03  0:00 ` Robert Dewar
1997-10-25  0:00 DHBemis
1997-10-26  0:00 ` Tom Moran
1997-10-27  0:00   ` DHBemis
replies disabled

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