logo
  • 教程列表
  • SO官方文檔
  • Groovy 真相(真實的)
    • 數字布林評估
    • 字串布林評估
    • 集合和對映布林值評估
    • 物件布林值評估
    • 覆蓋使用者定義的類中的布林值評估
    • 人物評價
    • 匹配評估
    • 關閉評估
  1. StackOverflow 文件
  2. groovy 教程
  3. Groovy 真相(真實的)
  4. 字串布林評估

字串布林評估

Created: November-22, 2018

如果不為 null 且不為空,則字串(包括 GStrings)的計算結果為 true;如果為 null 或為空,則為 false

def s = ''
...
if (s) 
    println 's is not empty'
else
    println 's is empty'

將列印:’s 為空'

  • 集合和對映布林值評估
  • 數字布林評估

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明