1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-21 03:39:43 +00:00

Add type "number: (default)" to compare operator (#8160)

* Add type "number: (default)" to compare operator

* Update compare Operator.tid

* Update compare Operator (Examples).tid

* Update compare Operator (Examples).tid
This commit is contained in:
Mario Pietsch 2024-09-10 18:13:09 +02:00 committed by GitHub
parent feec6ef18f
commit 232cffb0a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 9 deletions

View File

@ -1,15 +1,15 @@
caption: compare
created: 20200412181551706
modified: 20200412181551706
op-input: a [[selection of titles|Title Selection]]
op-neg-output: those input titles <<.em not>> matching the specified comparison
op-output: those input titles matching the specified comparison
op-parameter: the value to compare
op-purpose: filter the input by comparing each item against the parameter
op-suffix: the <<.op compare>> operator uses a rich suffix, see below for details
tags: [[Filter Operators]] [[Mathematics Operators]] [[String Operators]] [[Negatable Operators]]
title: compare Operator
type: text/vnd.tiddlywiki
caption: compare
op-purpose: filter the input by comparing each item against the parameter
op-input: a [[selection of titles|Title Selection]]
op-suffix: the <<.op compare>> operator uses a rich suffix, see below for details
op-parameter: the value to compare
op-output: those input titles matching the specified comparison
op-neg-output: those input titles <<.em not>> matching the specified comparison
<<.from-version "5.1.22">>The <<.op compare>> filter allows numerical, string and date comparisons to be performed.
@ -21,7 +21,7 @@ The <<.op compare>> operator uses an extended syntax to specify all the options:
The ''type'' can be:
* "number" - invalid numbers are interpreted as zero
* "number" - (default) invalid numbers are interpreted as zero
* "integer" - invalid integers are interpreted as zero
* "string"
* "date" - invalid dates are interpreted as 1st January 1970
@ -43,7 +43,7 @@ For example:
```
[[2]compare:number:eq[3]] returns nothing
[[2]compare:number:lt[3]] returns "2"
[[2]compare:number:eq[2]] returns "2"
[[2]compare::eq[2]] returns "2"
```
Note that several of the variants of the <<.op compare>> operator are synonyms for existing operators, and are provided in the interests of consistency. For example, `compare:string:eq[x]` is a synonym for `match[x]`.

View File

@ -9,3 +9,4 @@ type: text/vnd.tiddlywiki
<<.operator-example 3 "[list[Days of the Week]compare:string:gt[M]compare:string:lt[W]]">>
<<.operator-example 4 "[[v5.1.23-prerelease]compare:version:gt[v5.1.22]]">>
<<.operator-example 5 "[[1]compare:number:gt[2]then[yes]else[no]]">>
<<.operator-example 6 "[[-2]compare::lt[-1]]">>