Skip to content

Commit 8ce7ee6

Browse files
authored
Merge pull request #480 from kcl-lang/faq-isnullish-func
docs: add isnullish function faq documents
2 parents 44e7f0d + 6eca023 commit 8ce7ee6

File tree

4 files changed

+40
-0
lines changed
  • docs/user_docs/support
  • i18n/zh-CN/docusaurus-plugin-content-docs
  • versioned_docs/version-0.10/user_docs/support

4 files changed

+40
-0
lines changed

docs/user_docs/support/faq-kcl.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,16 @@ isEmptyList = bool(_emptyList)
482482
isEmptyDict = bool(_emptyDict)
483483
```
484484

485+
In addition, if we want to determine that a variable is only `None`/`Undefined` and not empty, we can use the following expression or the built-in function `isnullish()`
486+
487+
```python
488+
a = None
489+
_emptyList = []
490+
isEmptyList = bool(_emptyList)
491+
isNullishList1 = _emptyList not in [None, Undefined]
492+
isNullishList2 = isnullish(_emptyList)
493+
```
494+
485495
## 12. How to concatenate strings, format strings, check string prefixes and suffixes and replace string content?
486496

487497
- The `+` operator can be used to concatenate two strings in KCL

i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/support/faq-kcl.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,16 @@ isEmptyList = bool(_emptyList)
484484
isEmptyDict = bool(_emptyDict)
485485
```
486486

487+
此外,如果我们想要判断一个变量仅为 `None`/`Undefined`,而不为空,则可以使用下面的表达式或者 `isnullish()` 内置函数
488+
489+
```python
490+
a = None
491+
_emptyList = []
492+
isEmptyList = bool(_emptyList)
493+
isNullishList1 = _emptyList not in [None, Undefined]
494+
isNullishList2 = isnullish(_emptyList)
495+
```
496+
487497
## 12. 字符串怎样拼接、怎样格式化字符串、怎样检查字符串前缀、后缀?怎样替换字符串内容?
488498

489499
- KCL 中可以使用 `+` 运算符连接两个字符串

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.10/user_docs/support/faq-kcl.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,16 @@ isEmptyList = bool(_emptyList)
484484
isEmptyDict = bool(_emptyDict)
485485
```
486486

487+
此外,如果我们想要判断一个变量仅为 `None`/`Undefined`,而不为空,则可以使用下面的表达式或者 `isnullish()` 内置函数
488+
489+
```python
490+
a = None
491+
_emptyList = []
492+
isEmptyList = bool(_emptyList)
493+
isNullishList1 = _emptyList not in [None, Undefined]
494+
isNullishList2 = isnullish(_emptyList)
495+
```
496+
487497
## 12. 字符串怎样拼接、怎样格式化字符串、怎样检查字符串前缀、后缀?怎样替换字符串内容?
488498

489499
- KCL 中可以使用 `+` 运算符连接两个字符串

versioned_docs/version-0.10/user_docs/support/faq-kcl.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,16 @@ isEmptyList = bool(_emptyList)
482482
isEmptyDict = bool(_emptyDict)
483483
```
484484

485+
In addition, if we want to determine that a variable is only `None`/`Undefined` and not empty, we can use the following expression or the built-in function `isnullish()`
486+
487+
```python
488+
a = None
489+
_emptyList = []
490+
isEmptyList = bool(_emptyList)
491+
isNullishList1 = _emptyList not in [None, Undefined]
492+
isNullishList2 = isnullish(_emptyList)
493+
```
494+
485495
## 12. How to concatenate strings, format strings, check string prefixes and suffixes and replace string content?
486496

487497
- The `+` operator can be used to concatenate two strings in KCL

0 commit comments

Comments
 (0)