How to resolve the algorithm Rosetta Code/Fix code tags step by step in the REXX programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Rosetta Code/Fix code tags step by step in the REXX programming language

Table of Contents

Problem Statement

Fix Rosetta Code deprecated code tags, with these rules:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Rosetta Code/Fix code tags step by step in the REXX programming language

Source code in the rexx programming language

/*REXX program  fixes (changes)  depreciated  HTML  code tags  with  newer tags.        */
@="<";  old.=;        old.1 = @'%s>'         ;     new.1 = @"lang %s>"
                      old.2 = @'/%s>'        ;     new.2 = @"/lang>"
                      old.3 = @'code %s>'    ;     new.3 = @"lang %s>"
                      old.4 = @'/code>'      ;     new.4 = @"/lang>"

iFID = 'Wikisource.txt'                          /*the  Input File  IDentifier.         */
oFID = 'converted.txt'                           /*the Output   "      "                */

  do  while lines(iFID)\==0                      /*keep reading the file until finished.*/
  $= linein(iFID)                                /*read a record from the input file.   */
                     do j=1  while old.j \== ''  /*change old ──► new  until  finished. */
                     $= changestr(old.j,$,new.j) /*let REXX do the heavy lifting.       */
                     end   /*j*/
  call lineout oFID,$                            /*write re-formatted record to output. */
  end   /*while*/                                /*stick a fork in it,  we're all done. */


  

You may also check:How to resolve the algorithm Fixed length records step by step in the AWK programming language
You may also check:How to resolve the algorithm Numerical integration/Gauss-Legendre Quadrature step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm SHA-256 step by step in the Go programming language
You may also check:How to resolve the algorithm Arena storage pool step by step in the Pascal programming language
You may also check:How to resolve the algorithm Conditional structures step by step in the MAXScript programming language