BoolExt extension
- @Author: chuxiong
- @Created at: 2023/3/2 4:05 下午
- @Email:
- @Company: 嘉联支付
- description bool 扩展:提供取反、逻辑运算、条件取值与类型转换等便捷方法。
- on
Properties
- not → bool
-
Available on bool, provided by the BoolExt extension
逻辑取反(等价于!this,便于链式调用)。no setter - toInt → int
-
Available on bool, provided by the BoolExt extension
转为整数:true→1,false→0。no setter - toStringVal → String
-
Available on bool, provided by the BoolExt extension
转为字符串:'true'/'false'(与toString()等价的语义化别名)。no setter
Methods
-
ifElse<
T> (T ifTrueValue, T ifFalseValue) → T -
Available on bool, provided by the BoolExt extension
条件返回值:true返回ifTrueValue,false返回ifFalseValue。 -
ifFalse<
T> (T value) → T? -
Available on bool, provided by the BoolExt extension
当本值为false时返回value,否则返回null。 -
ifTrue<
T> (T value) → T? -
Available on bool, provided by the BoolExt extension
当本值为true时返回value,否则返回null。
Operators
-
operator &(
bool other) → bool -
Available on bool, provided by the BoolExt extension
逻辑与(等价于this && other,可用作中缀运算符a & b)。 -
operator |(
bool other) → bool -
Available on bool, provided by the BoolExt extension
逻辑或(等价于this || other,可用作中缀运算符a | b)。