restoreLineEndings function

String restoreLineEndings(
  1. String text,
  2. LineEnding ending
)

Re-encodes LF text with the requested line ending.

Implementation

String restoreLineEndings(String text, LineEnding ending) {
  return ending == LineEnding.crlf ? text.replaceAll('\n', '\r\n') : text;
}