HOME - - - - - Lazarus Tutorials TOC - - - - - - Other material for programmers
Delicious.Com Bookmark this on Delicious     StumbleUpon.Com Recommend to StumbleUpon

Massaging HTML text. Working with nested loops.

This has good information, and a search button at the bottom of the page

Please don't dismiss it because it isn't full of graphics, scripts, cookies, etc!

This page is "browser friendly". Make your browser window as wide as you want it. The text will flow nicely for you. It is easier to read in a narrow window. With most browsers, pressing plus, minus or zero while the control key (ctrl) is held down will change the texts size. (Enlarge, reduce, restore to default, respectively.) (This is more fully explained, and there's another tip, at my Power Browsing page.)

This is an unusal "tutorial" in that (for now... and probably some time to come) I am giving away the sourcecode, but not doing a lot of explaining.

I've tested what follows in Lazarus. I cannot thinl of any reason it would not work just as well under Delphi.

What the application does...

When you run the application you are invited to load a file. Once you have loaded it, if you click the "massage" button, the program will go through the file, and, only inside any >pre<>/pre< blocks, it will change any >s to &gt;, any <s to &lt; and any &s to &amp;s

Of you clicked the "Massage And Overwrite" button, your original file will be over-written... without an "are you sure?" prompt. So be careful. Work with copies of important files.

Why would you want such a application? Well, if you, like me, write tutorials for the web with things like...

if x>5 then...

... in them, then maybe you too will find the program useful.

In more general terms, even if you don't need the application to use in anger, it has examples of using nested loops, boolean "flag" variables to control the execution of elements of the program, and subroutines (with and without passed variables) to "divide and conquer" a problem.

As I said, I am not going to write much of a "tutorial" to go with this sourcecode, but I commend the problem to you. It wasn't easy to write even a badly written program to do the job. Try it, if you like a challenge.

A zip file is available to you, with both the sourcecode of the application, and a pre-compiled .exe file for immediate use.

Beware one little "rough edge": You can do a "Massage and overwrite" before doing a "Load file"... but you shouldn't: the application doesn't yet know WHERE, or under WHAT NAME to save what is in the memo! (I'm not sure what happens if you try it!

            powered by FreeFind
  Site search Web search
Site Map    What's New    Search This search merely looks for the words you enter. It won't answer "Where can I download InpOut32?"

If you visit 1&1's site from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service. They offer things for the beginner and the corporation.www.1and1.com icon

Ad from page's editor: Yes.. I do enjoy compiling these things for you. I hope they are helpful. However... this doesn't pay my bills!!! Sheepdog Software (tm) is supposed to help do that, so if you found this stuff useful, (and you run a Windows or MS-DOS PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

Link to Lazarus Tutorials main page
How to contact the editor of this page, Tom Boyd

Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org. Mostly passes. There were two "unknown attributes" in Google+ button code. Sigh.

If this page causes a script to run, why? Because of things like Google panels, and the code for the search button. Why do I mention scripts? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....