diff --git a/Faclon.Extend.sln b/Faclon.Extend.sln new file mode 100644 index 0000000..dd08a36 --- /dev/null +++ b/Faclon.Extend.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29613.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Faclon.Extend", "Faclon.Extend\Faclon.Extend.csproj", "{F77EDE31-EBB5-42E9-85C3-1501D2B0CA81}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Faclon.ExtendTests", "Faclon.ExtendTests\Faclon.ExtendTests.csproj", "{3C7A5D31-3FB4-4DDA-8283-5CB81BE63150}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F77EDE31-EBB5-42E9-85C3-1501D2B0CA81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F77EDE31-EBB5-42E9-85C3-1501D2B0CA81}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F77EDE31-EBB5-42E9-85C3-1501D2B0CA81}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F77EDE31-EBB5-42E9-85C3-1501D2B0CA81}.Release|Any CPU.Build.0 = Release|Any CPU + {3C7A5D31-3FB4-4DDA-8283-5CB81BE63150}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C7A5D31-3FB4-4DDA-8283-5CB81BE63150}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C7A5D31-3FB4-4DDA-8283-5CB81BE63150}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C7A5D31-3FB4-4DDA-8283-5CB81BE63150}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {FF964C7D-2826-4608-A52B-06BB952F1DC8} + EndGlobalSection +EndGlobal diff --git a/Faclon.Extend/Faclon.Extend.csproj b/Faclon.Extend/Faclon.Extend.csproj new file mode 100644 index 0000000..6237e14 --- /dev/null +++ b/Faclon.Extend/Faclon.Extend.csproj @@ -0,0 +1,14 @@ + + + + netstandard2.0;netstandard2.1 + true + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml + http://39.105.71.191/Falcon/Falcon.Extend + http://39.105.71.191/Falcon/Falcon.Extend + .NET 基础类型方法扩展 + Falcon + + + diff --git a/Faclon.Extend/StringExtend.cs b/Faclon.Extend/StringExtend.cs new file mode 100644 index 0000000..55328a4 --- /dev/null +++ b/Faclon.Extend/StringExtend.cs @@ -0,0 +1,26 @@ +namespace Faclon.Extend +{ + /// + /// 字符串处理扩展 + /// + public static class StringExtend + { + /// + /// 是否为Null或Empty + /// + /// 要判断的字符串 + /// 如果为Null或Empty返回True,否则False + public static bool IsNullOrEmpty(this string str) { + return str == null ? true : string.IsNullOrEmpty(str); + } + + /// + /// 是否为Null或Empty + /// + /// 要判断的字符串 + /// 如果为Null或Empty返回True,否则False + public static bool IsNotNullOrEmpty(this string str) { + return !str.IsNullOrEmpty(); + } + } +} diff --git a/Faclon.ExtendTests/Faclon.ExtendTests.csproj b/Faclon.ExtendTests/Faclon.ExtendTests.csproj new file mode 100644 index 0000000..4dbea6c --- /dev/null +++ b/Faclon.ExtendTests/Faclon.ExtendTests.csproj @@ -0,0 +1,20 @@ + + + + netcoreapp3.0;netcoreapp3.1 + + false + + + + + + + + + + + + + + diff --git a/Faclon.ExtendTests/StringExtendTests.cs b/Faclon.ExtendTests/StringExtendTests.cs new file mode 100644 index 0000000..348e8b5 --- /dev/null +++ b/Faclon.ExtendTests/StringExtendTests.cs @@ -0,0 +1,24 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Faclon.Extend.Tests +{ + [TestClass()] + public class StringExtendTests + { + [TestMethod()] + public void IsNullOrEmptyTest() { + string str = null; + Assert.IsTrue(str.IsNullOrEmpty()); + Assert.IsFalse(str.IsNotNullOrEmpty()); + str = ""; + Assert.IsTrue(str.IsNullOrEmpty()); + Assert.IsFalse(str.IsNotNullOrEmpty()); + str = string.Empty; + Assert.IsTrue(str.IsNullOrEmpty()); + Assert.IsFalse(str.IsNotNullOrEmpty()); + str = "abc"; + Assert.IsFalse(str.IsNullOrEmpty()); + Assert.IsTrue(str.IsNotNullOrEmpty()); + } + } +} \ No newline at end of file