Groups | Search | Server Info | Login | Register
Groups > comp.lang.rexx > #3843
| From | Bob Eager <news0009@eager.cx> |
|---|---|
| Newsgroups | alt.folklore.computers, comp.lang.rexx |
| Subject | Re: The joy of FORTRAN |
| Date | 2024-09-29 10:18 +0000 |
| Message-ID | <llsns7FmmqaU30@mid.individual.net> (permalink) |
| References | (11 earlier) <llnt42FmmqaU21@mid.individual.net> <20240928093323.cfbd5563af05e97315be1989@127.0.0.1> <llq1b7FmmqaU25@mid.individual.net> <20240929091910.ef0649ce9c20122b9bdcadae@127.0.0.1> <vdb6a6$5viq$1@paganini.bofh.team> |
Cross-posted to 2 groups.
On Sun, 29 Sep 2024 11:23:18 +0200, R Daneel Olivaw wrote:
> Kerr-Mudd, John wrote:
>> On 28 Sep 2024 09:41:59 GMT Bob Eager <news0009@eager.cx> wrote:
>>
>>> On Sat, 28 Sep 2024 09:33:23 +0100, Kerr-Mudd, John wrote:
>>>
>>>> I was too lazy to dig into my rusty brain to code the equivalent in
>>>> Rexx,
>>>> I was hoping someone here would do it!
>>>>
>>>>>>>> for item in "the,quick,brown,fox".split(",") :
>>>>>>>> print(item)
>>>>>>>> #end for
>>>>
>>>> OK,OK. Cribbed & hacked from a stackoverflow answer:
>>>> https://stackoverflow.com/questions/15437494/rexx-parse-a-csv-line-
>>> separator
>>>>
>>>>
>>>> myline="the,quick,brown,fox"
>>>>
>>>> do i = 1 by 1 while myline <> ''
>>>> parse var myline w.i ',' myline
>>>> end w.0 = i-1
>>>>
>>>> do i = 1 to w.0
>>>> say w.i
>>>> end
>>>>
>>>>
>>>> Hmm, must be a shorter way without the bother of setting up the stem
>>>> array.
>>>
>>> If you use space as a delimiter, which I would argue is more natural:
>>>
>>> ------------------------------------------
>>> myline="the quick brown fox"
>>>
>>> do i = 1 to words(myline)
>>> say word(myline, i)
>>> end ------------------------------------------
>>>
>>>
>> Thanks; It's been yea^w decades since I used Rexx. And even then not
>> extensively. But Rexx has "Parse" which few(no?) other languages have.
>>
>>
> What does "parse" do?
> I just had a look at some REXX documentation but it was not particularly
> helpful, it looked to me to be something which a couple of FORTRAN 77
> function calls would have handled perfectly adequately.
It essentially splits a string into substrings, using specified
delimiters. The source string may be from a variety of places (variable,
argument array, input line, stack) and there are some weird special cases
such as getting the version number.
Essentially, you specify a template and it splits the string in accordance
with that. For example:
parse var s1 "," s2 "-" s3
--
Using UNIX since v6 (1975)...
Use the BIG mirror service in the UK:
http://www.mirrorservice.org
Back to comp.lang.rexx | Previous | Next — Previous in thread | Next in thread | Find similar
Re: The joy of FORTRAN "Kerr-Mudd, John" <admin@127.0.0.1> - 2024-09-28 09:33 +0100
Re: The joy of FORTRAN Bob Eager <news0009@eager.cx> - 2024-09-28 09:41 +0000
Re: The joy of FORTRAN "Kerr-Mudd, John" <admin@127.0.0.1> - 2024-09-29 09:19 +0100
Re: The joy of FORTRAN R Daneel Olivaw <Danny@hyperspace.vogon.gov> - 2024-09-29 11:23 +0200
Re: The joy of FORTRAN Bob Eager <news0009@eager.cx> - 2024-09-29 10:18 +0000
Re: The joy of FORTRAN R Daneel Olivaw <Danny@hyperspace.vogon.gov> - 2024-09-29 16:47 +0200
Re: The joy of FORTRAN Peter Flass <peter_flass@yahoo.com> - 2024-09-29 13:15 -0700
Re: The joy of FORTRAN Bob Eager <news0009@eager.cx> - 2024-09-29 10:10 +0000
Re: The joy of FORTRAN Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-09-29 23:37 +0000
Re: The joy of FORTRAN lar3ryca <larry@invalid.ca> - 2024-10-08 19:53 -0600
Re: The joy of Python Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-10-09 05:46 +0000
Re: The joy of Python p.dean@invalid.net (Peter Dean) - 2024-10-09 07:12 +0000
Re: The joy of Python "Kerr-Mudd, John" <admin@127.0.0.1> - 2024-10-09 09:27 +0100
Re: The joy of Python lar3ryca <larry@invalid.ca> - 2024-10-09 21:42 -0600
Re: The joy of Python p.dean@invalid.net (Peter Dean) - 2024-10-10 04:39 +0000
csiph-web