REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 3-Aug-2010 Edit History  

REBOL 3 Functions: deline

deline  string  /lines

Converts string terminators to standard format, e.g. CRLF to LF. (Modifies)


string [any-string!]


/lines - Return block of lines (works for LF, CR, CR-LF endings) (does not modify)

See also:

enline   read  


Useful for converting OS dependent string terminators to LF.

CRLF string termination:

deline "a^M^/b" ; Windows, DOS, CP/M, OS/2, Symbian

CR string termination:

deline "a^Mb" ; MacOS 1-9

LF string termination:

deline "a^/b" ; MacOSX, AmigaOS, FreeBSD, GNU/Linux, BeOS, RiscOS

When using the /LINES refinement, the string will be split in blocks of strings per line:

deline/lines "a^M^/b"

Note that when reading from disk, READ/STRING provides the same functionality. The file %/c/text.txt was first saved with WIndows XP Notepad, which gives CRLF. When read, it gives:

read/string %/c/text.txt
"Windows text^/file"

  TOC < Back Next > - WIP Wiki Feedback Admin