detectEOL method

String detectEOL(
  1. String fileContent
)

Implementation

String detectEOL(String fileContent) {
  // Check for Windows EOL
  if (fileContent.contains('\r\n')) {
    return '\r\n'; // Windows EOL sequence (CRLF)
  }
  // Check for Unix EOL
  else if (fileContent.contains('\n')) {
    return '\n'; // Unix EOL sequence (LF)
  } else {
    return 'unknown'; // No recognizable EOL sequence found
  }
}