Link Search Menu Expand Document

Comparisons

PCGEx’ comparison overview

This page lists the comparison used by a bunch of different nodes.


There’s a lot of node in PCGEx that offer comparison settings – either numeric or string based. This is a summary of these; individual pages will link to this.


Numeric comparisons


Comparison Data
== Strictly equal.
!= Strictly not equal.
>= Equal or greater.
<= Equal or smaller.
> Strictly greater.
< Strictly smaller.
~= Nearly equal.
!~= Nearly not equal.

Approximative comparison will reveal an additional parameter, dubbed Tolerance. This represents the size of acceptable approximation for the comparison to pass. For example, when checking if 0.5 ~= 0.4 with a tolerance of 0.1 will return true.

Large tolerances can be a great, cheap way to achieve results akin to a “within range” comparison!


String comparisons


Comparison Data
== Strictly equal.
!= Strictly not equal.
== (Length) String lengths are strictly equal.
!= (Length) String lengths are strictly not equal.
>= (Length) String length is equal or greater.
<= (Length) String lengths are is equal or smaller.
> (Length) String lengths is strictly greater.
< (Length) String lengths is Strictly smaller.
> (Locale) String locale is strictly greater.
In alphabetical order. (Z is greater than A)
< (Locale) String locale is strictly smaller.
In alphabetical order. (A is smaller than Z)
Contains Check if string is contained in another one.
Useful if you have solid naming conventions.
Starts With Check if the string starts with another one.
Useful for prefixes.
Ends With Check if the string ends with another one.
Useful for suffixes.

Bitmask comparisons


Comparison Data
Match (any) Value & Mask != 0 (At least some flags in the mask are set)
Match (all) Value & Mask == Mask (All the flags in the mask are set)
Match (strict) Value == Mask (Flags strictly equals mask)
No Match (any) Value & Mask == 0 (Flags does not contains any from mask)
No Match (all) Value & Mask != Mask (Flags does not contains the mask)