Skip to content

SunamoToUnixLineEnding

Extension method for forced conversion of \r\n to \n for use by the same applications on Windows and Linux


Extension methods for forced conversion of \r\n to \n for use by the same applications on Windows and Linux.

Overview

SunamoToUnixLineEnding is part of the Sunamo package ecosystem, providing modular, platform-independent utilities for .NET development.

Main Components

Key Classes

  • Consts2 - Constants for line ending characters (Newline, CarriageReturnNewline)
  • IListToUnixLineEndingExtensions - Extension method for converting line endings in IList<string>
  • StringToUnixLineEndingExtensions - Extension method for converting line endings in string

Key Methods

  • ToUnixLineEnding() - Converts all line endings to Unix format (LF only)

Installation

dotnet add package SunamoToUnixLineEnding

Usage

using SunamoToUnixLineEnding;

// Convert a single string
string text = "Hello\r\nWorld";
string unixText = text.ToUnixLineEnding(); // "Hello\nWorld"

// Convert all strings in a list
IList<string> lines = new List<string> { "line1\r\npart1", "line2\r\npart2" };
lines.ToUnixLineEnding(); // All elements now use \n

Dependencies

  • Microsoft.Extensions.Logging.Abstractions

Package Information

  • Package Name: SunamoToUnixLineEnding
  • Target Frameworks: net10.0, net9.0, net8.0
  • License: MIT
  • Category: Platform-Independent NuGet Package

This package is part of the Sunamo package ecosystem. For more information about related packages, visit the main repository.

License

See the repository root for license information.