Back to DFS's Pascal Page


Editor Problem

Include all of the following features in a single program.

  1. Read in a text file of up to twelve (12) lines into an array.
  2. The user is allowed to change the text by insertion, deletion, replacement, upcasing.
  3. The user is allowed to get the following information printed out: length of the whole string, location of a sub-string.
  4. The user is responsible for saving changes if he wants to.
  5. The user is permitted to open a different file. He is responsible for saving the file currently open.
  6. A one-line menu is presented to the user each time after the array is printed below a character scale line.
  7. Each operation is to be handled in a separate procedure.
  8. The following is an example run using a limerick by Rudyard Kipling (http://www.freewebs.com/grahamlester/classics.htm). N.B. ^ indicates a space in the input.
   1234567890123456789012345678901234567890
01 There was a small boy of Quebec
02 Who was buried in snow to his neck.
03 When they said, "Are you friz?"
04 He replied, "Yes, I is --
05 But we don't call this cold in Quebec."
(O)pen (S)ave (I)nsert (D)elete (R)eplace (U)pcase (F)ind (L)ength (Q)uit: f
Find what string? in^
"in " was found at
Line 02 Pos 16
Line 05 Pos 29
(Alternatively, you could highlight the requested text.)

(O)pen (S)ave (I)nsert (D)elete (R)eplace (U)pcase (F)ind (L)ength (Q)uit: R
In which line? 3
Replace what string? they
With what string? she

(O)pen (S)ave (I)nsert (D)elete (R)eplace (U)pcase (F)ind (L)ength (Q)uit: I
Insert what string? all^
Where? 2 9

(O)pen (S)ave (I)nsert (D)elete (R)eplace (U)pcase (F)ind (L)ength (Q)uit: u
Upcase what string? Quebec
Where? 1 26

(O)pen (S)ave (I)nsert (D)elete (R)eplace (U)pcase (F)ind (L)ength (Q)uit: L
Which line? 4
Line 4 is 26 characters long.

(O)pen (S)ave (I)nsert (D)elete (R)eplace (U)pcase (F)ind (L)ength (Q)uit: D
Delete what string? buried
Which line? 2

(O)pen (S)ave (I)nsert (D)elete (R)eplace (U)pcase (F)ind (L)ength (Q)uit: s
Using what name? MessUp.txt

(O)pen (S)ave (I)nsert (D)elete (R)eplace (U)pcase (F)ind (L)ength (Q)uit: q

© DFStermole 2008
Created 1 May 08
Modified 11 May 08