Help:Sbp.func.empty
From Semantic Portal Wiki
Contents |
Description
| Help:Sbp.func.empty | Template:Sbp.func.empty |
- description: Evaluate a string. (0/yes/empty, -1/null, 1/no/non-empty)
- module: Help:SMW FIT
- version: 0.1
- status: unstable
- author: Li Ding
Overview
This is a function that evaluates a string, especially the parameter passed to a template. The default output of this function can be four
- 0 (empty) this is a empty string
- 1 (some) this is a non-empty string, and not the same as default value
- 2 (null) this is a null string
- 3 (default) this is a non-empty string, but it is the same as default value
The default option was introduce to help passing parameters between templates.
User are also allowed override the default output by assigning
- out_default
- out_null
- out_empty
- out_some
Examples
Example1. identify state of a template parameter
When passing to a template, a parameter could be in 'null' 'empty string', 'non-empty string', 'default-string' status.
| expect | output |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
Example2. customized output
When passing to a template, a parameter could be in 'null' 'empty string', 'non-empty string', 'default-string' status.
| expect | output |
|---|---|
| empty | empty |
| some | some |
| null | null |
| default | default |

