From 1ea481e749e4f84642f26381fa46a67494627d94 Mon Sep 17 00:00:00 2001 From: nsnail Date: Fri, 9 Dec 2022 11:24:01 +0800 Subject: [PATCH] 1.0.7 --- code-format.cmd | 6 +++--- src/NSExt/Extensions/StringExtensions.cs | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/code-format.cmd b/code-format.cmd index 51fa0a1..dd2fd79 100644 --- a/code-format.cmd +++ b/code-format.cmd @@ -1,3 +1,3 @@ -do.exe trim-utf8-bom -do.exe remove-whitespace -do.exe convert-lf \ No newline at end of file +dot rbom -w +dot trim -w +dot tolf -w \ No newline at end of file diff --git a/src/NSExt/Extensions/StringExtensions.cs b/src/NSExt/Extensions/StringExtensions.cs index 55ba47d..b23b39b 100644 --- a/src/NSExt/Extensions/StringExtensions.cs +++ b/src/NSExt/Extensions/StringExtensions.cs @@ -522,6 +522,16 @@ public static class StringExtensions .ToLower(CultureInfo.CurrentCulture); } + /// + /// 纯文本字符串转html + /// + /// + /// + public static string Text2Html(this string me) + { + return me.Replace(" ", " ").Replace("\r\n", "
").Replace("\r", "
").Replace("\n", "
"); + } + /// /// 蛇形命名