zoukankan      html  css  js  c++  java
  • 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
     
     
  • 相关阅读:
    OC中ARC forbids explicit message send of release错误
    OC中内存管理(转)
    [题解]数学期望_luogu_P1850_换教室
    [题解](单调队列)luogu_P2216_BZOJ_1047 理想的正方形
    [题解]luogu_AT1224_JOIOJI
    [题解]区间dp_luogu_P3147 262144
    [筆記]歐拉路
    [題解/狀壓dp]POJ_2411_Mondriaan's dream
    [題解]luogu_P1854 花店櫥窗佈置
    [題解]luogu_P1052 過河
  • 原文地址:https://www.cnblogs.com/RocCnBlog/p/14079520.html
Copyright © 2011-2022 走看看