Count¶
Name | - | Description | Default | Type |
---|---|---|---|---|
<input> |
Any input is ignored. | |||
<output> |
Count of characters, elements, or key-value pairs contained in the :Name parameter variable. |
Int |
||
Name |
The name of the variable. | "" |
String &Any |
|
Key |
The key of the value to read from the table (parameter applicable only if the target variable is a table). | None |
String &String |
|
Global |
If the variable is available to all of the wires in the same mesh. | false |
Bool |
Parses the value in passed to in the :Name
parameter and returns the count of characters (if string passed), elements (if sequence passed), or key-value pairs (if table passed).
Details¶
Count
parses the value passed to it in the :Name
parameter, and returns the count of characters, elements, or key-value pairs depending on whether the data type passed to it was a string, a sequence, or a table.
If this shard is applied to a number it returns zero as the count.
This shard works on both sequences and tables. Parameter :Key
applies only to tables.
Since variables may be locally scoped (created with (:Global false)
; exists only for current wire) or globally scoped (created with (:Global true)
; exists for all wires of that mesh), both parameters :Global
and :Name
are used in combination to identify the correct variable to count.
Input field is ignored and the output of this shard is the count value in Int
type.
Examples¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
[info] Set - Warning: setting an already exposed variable "stringvar", use Update to avoid this warning.
[info] [shards/General/Count/Count.edn] 6
[info] [shards/General/Count/Count.edn] 3
[info] [shards/General/Count/Count.edn] 2
[info] [shards/General/Count/Count.edn] 0
[info] [shards/General/Count/Count.edn] 12
[info] [shards/General/Count/Count.edn] 13