diff --git a/SacsStandardBase/Base/Utils/StringUtil.cs b/SacsStandardBase/Base/Utils/StringUtil.cs index 3d0be83..39ef2a6 100644 --- a/SacsStandardBase/Base/Utils/StringUtil.cs +++ b/SacsStandardBase/Base/Utils/StringUtil.cs @@ -15,6 +15,7 @@ namespace Sarand.Net.Standard.Base.Utils // Definitions. public static Regex RegEx_Whitespace = new Regex("\\s+"); public static Regex RegEx_Whitespace_Match = new Regex("^\\s+$"); + public static Regex RegEx_LineDelimiters = new Regex(@"\r\n?|\n"); //------------------------------------------------------------------- // Properties. @@ -276,6 +277,18 @@ namespace Sarand.Net.Standard.Base.Utils return value.Replace(search.ToString(), search.ToString() + search.ToString()); } + //------------------------------------------------------------------- + /// + /// Replace all line delimiters (\r\n or \n). + /// + /// + /// + /// + public static String ConsolidateLineDelimiters(this String value, String replace = "\n") + { + return RegEx_LineDelimiters.Replace(value, replace); + } + //------------------------------------------------------------------- // E x t r a c t i o n //-------------------------------------------------------------------