text in fields (CR/LF, CR, LF) which is correct?

Dar Scott dsc at swcp.com
Fri Aug 30 00:09:00 EDT 2002


ASCII CR is 13 (decimal)
ASCII LF is 10 (decimal)

 From the Rev Doc--
Windows line-end:  ASCII CR LF  (But see below.)
Mac OS line-end:   ASCII CR
Unix line-end:     ASCII LF

Revolution:
The line-end is 10.
charToNum(linefeed) ==> 10
charToNum(return) ==> 10
charToNum(CR) ==> 10
charToNum(char 1 of CRLF) ==> 13
charToNum(char 2 of CRLF) ==> 10
(There is no LF constant.)

put "default" & numToChar(13) & "your" into field "report"
---displays-->
defaultyour

put "default" & numToChar(10) & "your" into field "report"
--->
default
your

put "default" & numToChar(13) & numToChar(13) & "your" into field 
"report"
--->
defaultyour

put "default" & numToChar(13) & numToChar(10) & "your" into field 
"report"
--->
default
your

put "default" & numToChar(10) & numToChar(13) & "your" into field 
"report"
--->
default
your

put "default" & numToChar(10) & numToChar(10) & "your" into field 
"report"
--->
default

your

Binary I/O will preserve numToChar(10) and numToChar(13).  Text I/O 
will attempt to convert to and from the standard for the the 
current platform.  (Text I/O doesn't always work right.  First, 
this is because the standard is violated; some Windows apps use 
ASCII CR-LF-LF for double spacing.  Second, it may not work as 
expected; for example, on Windows, read process will convert every 
ASCII CR-LF to ASCII LF-LF instead of LF, creating a double 
spacing.)

I hope this helps.

Dar Scott




More information about the use-livecode mailing list