src/YL.Utils/Extensions/StringExt.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;

namespace YL.Utils.Extensions

{
    /// <summary>
    /// String扩展
    /// </summary>
    public static class StringExt
    {
        /// <summary>
        /// 是null还是string.Empty
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool IsNull(this string str)
        {
            return string.IsNullOrEmpty(str);
        }

        /// <summary>
        /// null、空还是仅由空白字符串组成
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static bool IsEmpty(this string str)
        {
            return string.IsNullOrWhiteSpace(str);
        }

        public static bool IsEmptyZero(this string str)
        {
            return string.IsNullOrWhiteSpace(str) || str == "0";
        }

        public static bool IsNull2(this string value)
        {
            return value == null || value == "" || value == string.Empty || value == " " || value.Length == 0;
        }

        public static bool IsEmpty(this object str)
        {
            if (str == null)
                return true;
            return string.IsNullOrWhiteSpace(str.ToString());
        }

        /// <summary>
        /// 判断是不是为null
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public static bool IsNullT<T>(this T t) where T : class
后面还有 119 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。