String Extensions that lets one to easily manipulate Newlines
Created
September 8, 2015 12:02
-
-
Save isawrub/f1e6881198861238935b to your computer and use it in GitHub Desktop.
NewLine Extensions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class StringExtensions | |
| { | |
| public static string RemoveLineBreaks( this string lines ) | |
| { | |
| return lines.Replace( "\r", "").Replace( "\n", "" ); | |
| } | |
| public static string ReplaceLineBreaks( this string lines, string replacement ) | |
| { | |
| return lines.Replace( "\r\n", replacement ) | |
| .Replace( "\r", replacement ) | |
| .Replace( "\n", replacement ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment