Removing CRLF from text

Mikey mikeythek at gmail.com
Thu Aug 7 09:43:06 EDT 2008


> I thought that CR and LF are basically the same thing. So, when I used:
>  replace "+"&CR with "" in field "demo"
>
>
They are not the same thing.  This goes back to the teletype days (and yes,
I have one sitting here), when the teletypes would communicate with each
other by sending binary codes over the line for each character, giving us
these character codes we use today.  IBM had a different scheme called
EBCIDEC, but for a whole host of reasons it is not the standard and the
ASCII set is.

Anyway, back in the TTY days, you had two keys on the keyboard - one is the
CR, which causes the carriage, i.e. the printhead and ribbon, to return to
the left margin.  The other is the line feed, which caused the platten to
advance one line.

If you wanted to skip one or more lines vertically you would just add more
<LF>'s instead of banging the carriage against the left side several times.

In this way, a lot of motion could be eliminated, which caused a dramatic
slowdown since the unit was mechanical.  If you were printing a box in the
middle of the page, for instance, you could either <CR><LF> then <SP> (times
a bunch) over to the next character to print OR you could <LF><BS>, which
put you right where you needed to be.  While <CR> was significantly faster
than a bunch of <BS>'s, it frequently wasn't if you were in the middle of
the page.

In the modern days, many systems use one or the other, i.e. either <CR> or
<LF> to mean the same thing.  Typically <CR> is used to mean end-of-line.
However, I have seen a fair number of implementations in Windoze where <LF>
is used instead.  Very infrequently do I see both together.

In the unix world is it not at all uncommon to see the <CR><LF>
combination.  In fact on some systems it is the default.
-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
and did a little diving.
And God said, "This is good."



More information about the use-livecode mailing list