unix2dos

string

Converts Unix-style line endings (LF) to Windows-style (CRLF)

Syntax

unix2dos(string)

Parameters

string (string)

The string to convert

Returns

string

String with Windows-style line endings

Examples

Input:
unix2dos("line1\nline2")
Output:
"line1\r\nline2"
Input:
"text\n" | unix2dos
Output:
"text\r\n"

The unix2dos() function converts Unix-style line endings (LF: \n) to Windows-style line endings (CRLF: \r\n).

Usage

Use unix2dos() when preparing text files for Windows systems, or when ensuring compatibility with Windows applications.

Related Functions