Text files driving me mad
dsc at swcp.com
Thu Jun 13 13:58:01 CDT 2002
On Thursday, June 13, 2002, at 10:54 AM, Bill Vlahos wrote:
> When getting a text file have the engine simply convert any
> combination of line feeds and/or carriage returns to something
> consistent internally like "return". This way any text would be
> opened correctly regardless of which platform it was made on.
> There might be some situations where this is not desirable but I
> bet not many.
I assume you mean linefeed; "return" is ambiguous in this context.
I would prefer to preserve blank lines. Also, I have seen apps
that generate crlflf for two line ends.
However there should be a method that we all like. Here is mine
The string is processed one character at a time like this:
numToChar(13) is mapped to an end-of-line.
numToChar(10) is mapped to an end-of-line if the previous char is
otherwise it is mapped to empty
where end-of-line is numToChar(10)
If conversions are on the entire string, then this:
convert the entire string converting crlf to something special
convert the entire string converting cr to lf
convert the entire string converting something special to lf
These should be the same if something special does not occur in the
More information about the use-livecode