🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #796

Processing Strings

#796
From: Barry.Cornelius
Date: Tue, 12 Jun 1990 14:45
28 lines
1371 bytes
In a previous message, Pete is having problems with his loops for processing
strings.   I suggest:
 PROCEDURE P(VAR S : ARRAY OF CHAR);
 VAR k,n   : CARDINAL;
 BEGIN
    n := Length(S);
    FOR k := 1 TO n DO
      process(S[k-1]);
    END;
If you don't like the "k-1" then the other alternative is:
 PROCEDURE P(VAR S : ARRAY OF CHAR);
 VAR k,n   : CARDINAL;
 BEGIN
    IF n>0 THEN
       FOR k := 0 TO n-1 DO
         process(S[k]);
       END
    END;
==
Barry Cornelius
==
Computer Science Group, School of Engineering and Applied Science,
University of Durham, Durham, DH1 3LE, England
              JANET:       Barry.Cornelius@uk.ac.durham
              Internet:    Barry.Cornelius%durham.ac.uk@cunyvm.cuny.edu
              UUCP:        ...ukc!cs.nott.ac.uk!bjc
              BITNET/EARN: Barry.Cornelius%DURHAM@AC.UK
Tel: Durham (091 or +44 91) 374 2638, Secretary: 374 2630, Fax: 374 3741
Technical Details
Message-ID: <emu-pr11.lg.1990.0612.154543.cok2@uk.ac.dur.mts>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!DURHAM.AC.UK!Barry.Cornelius

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!DURHAM.AC.UK!Barry.Cornelius
From: Barry.Cornelius@DURHAM.AC.UK
Newsgroups: comp.lang.modula2
Subject: Processing Strings
Message-ID: <emu-pr11.lg.1990.0612.154543.cok2@uk.ac.dur.mts>
Date: 12 Jun 90 14:45:43 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: Modula2 List <INFO-M2%UCF1VM.BITNET@PSUVM.PSU.EDU>
Organization: The Internet
Lines: 28