From db7f0ae344458b663d6be60c35688236414ba063 Mon Sep 17 00:00:00 2001 From: Andy Howard Date: Tue, 7 Feb 2023 08:46:10 +0000 Subject: [PATCH] Saxonite 1.2.10.4 --- SacsStandardBase/Base/Utils/StringUtil.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 //-------------------------------------------------------------------