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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d10c964e990dddc9,start X-Google-Attributes: gid103376,public From: "Marin David Condic, 561.796.8997, M/S 731-96" Subject: Re: Help me parse a long character Date: 1997/11/03 Message-ID: <97110312041905@psavax.pwfl.com>#1/1 X-Deja-AN: 286799793 Sender: Ada programming language Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU X-VMS-To: SMTP%"INFO-ADA@VM1.NODAK.EDU" X-VMS-Cc: CONDIC Newsgroups: comp.lang.ada Date: 1997-11-03T00:00:00+00:00 List-Id: DHBemis 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 ===============================================================================