text in fields (CR/LF, CR, LF) which is correct?
J. Landman Gay
jacque at hyperactivesw.com
Sat Aug 31 12:05:00 EDT 2002
Dar Scott <dsc at swcp.com> wrote:
> Maybe this will work...
>
> function adjustLineEndInput thetext
> replace (numtochar(13) & numtochar(10)) with numtochar(13) in thetext
> replace numtochar(13) with numtochar(10) in thetext -- fixed typo
> return thetext
> end adjustLineEndInput
>
> This is just yours above with a typo correction. It is even better
> than what I have been using. I'm going to try it!
>
> This even handles the hybrid cr lf lf correctly. Cool!
>
I hope I don't seem too dense, but I'm still not clear on why a script
would need to replace line endings manually this way. I'd like to
understand it. When would a simple replacement with the "return"
constant not work?
For example, in Kee's problem, I'd think that this would work okay:
get data from database, put it in a variable
replace database line endings with returns in the variable
put variable into a field
It seems to me that the above would convert all line endings to
machine-specific line endings without any manual manipulation, and would
go cross-platform without any changes. When the data needs to go back to
the database:
put the field text into a variable
replace returns with database-specific line endings
send variable back to the database
What am I missing? Doesn't this work?
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list