Wed, 18 Jun 1902 08:00:00 GMT
Query about manipulating strings in Pascal (HELP!!!)
QuoteBenjman wrote: > I have a task that needs to be completed (if possible) regarding > a small Turbo Pascal 7.0 code I am writing. The task that needs to > be done is a follows: > I need to code a program that can take a text file and read it. > It then needs to be able to remove specific words enclosed in a > special character that does not appear anywhere else in the document. > So, for example, if this special character was speech marks ("), then > the program could read the following: > ------------------- > ?bve"This"rNCvd"is"??-"a"nudfi > vBDf"test"bnjrevsB"message."hrehrt > ------------------- > And the output would be: 'This is a test message.' > ------------------- > Assuming the file to be 'decoded' is different ever time, can this > be done? Any help, or a little sample code would help me out no end.
It's not difficult. Some pseudocode: inquotes := false while not at end of file do get a character is it a quote? if yes, are we already in quotes? if yes, inquotes := false add a trailing space to string if no, inquotes := true if no, are we in quotes? if yes, add letter to string if no, discard letter There's your pseudocode (indentation indicates nesting, just used that to spare some extra typing). Quote> If you can't work it out either, don't worry, but there must be someone...! > Thanks in advance > -- > Ben > b...@benjman.demon.co.uk > P.S. It would be really useful if you could e-mail direct. Sorry, but there > are A LOT > of Pascal newsgroups out there! Thanks!
That doesn't mean you need to post to ALL of them. I trimmed the least relevant groups from the headers (about half of them). -- Scott Earnest | SPAM protection in effect. Remove | setech@_ix.netcom.com | "_" as needed for true addresses. | earnests@_homenet.lm.com | UIN:1136443 EFnet:pale_blue | sinykal@_{*word*104}space.org | URL: http://www.netcom.com/~setech |
|