• string.IsNullOrWhiteSpace


    测试环境:https://try.dot.net/

    Console.WriteLine(string.IsNullOrWhiteSpace(""));        -->  True
    Console.WriteLine(string.IsNullOrWhiteSpace(" "));          -->  True
    Console.WriteLine(string.IsNullOrWhiteSpace(" "));          -->  True
    Console.WriteLine(string.IsNullOrWhiteSpace(" "));          -->  True
    Console.WriteLine(string.IsNullOrWhiteSpace("     "));   -->  True
    Console.WriteLine(string.IsNullOrWhiteSpace(" "));          -->  True
    Console.WriteLine(string.IsNullOrWhiteSpace(null));          -->  True
    Console.WriteLine(string.IsNullOrWhiteSpace(""));        -->  False          空字符   所以如果输入字符串中含有 这样的单独串,使用 string.IsNullOrWhiteSpace 是应该注意
    Console.WriteLine(string.IsNullOrWhiteSpace(" "));  -->  True
    Console.WriteLine(string.IsNullOrWhiteSpace("v"));  -->  True
    Console.WriteLine(string.IsNullOrWhiteSpace(" "));  -->  True
    Console.WriteLine(string.IsNullOrWhiteSpace(" "));  -->  True
    Console.WriteLine(string.IsNullOrWhiteSpace("f"));  -->  True
    Console.WriteLine(string.IsNullOrWhiteSpace("a"));  -->  False  a   感叹号
    Console.WriteLine(string.IsNullOrWhiteSpace(""));  -->  False      退格
     
    Console.WriteLine("123"+'d');                 -->  123 d
    Console.WriteLine(("123"+'d').Length);             -->  5
    Console.WriteLine("\0"+'d');                   -->  d
    Console.WriteLine(@""+'d');                   -->  d
     
     
  • 相关阅读:
    SQLite打开提示database disk image is malformed
    windows查看端口占用
    新浪SAE使用Thinkphp框架,禁用memcache节省豆子的方法
    Realtek 8168 安装 VMware ESXi 提示没有驱动
    13年国庆彩蛋
    Flex使用宋体渲染越南语显示错误
    微信 编码要UTF8
    WeiXin 验证成为开发者和更换服务器验证代码
    测试网络连通情况
    废弃sqlite代码,备查
  • 原文地址:https://www.cnblogs.com/RocCnBlog/p/14079520.html
Copyright © 2020-2023  润新知