Find it language syntax
Case Sensitivity
The findit language is case-insensitive for keywords, operators, properties, functions, and methods. All of these are equivalent:
extension = "rs"=EXTENSION = "rs"=Extension = "rs"size > 1024 AND is file=SIZE > 1024 and IS FILEcontent.lines()=CONTENT.LINES()=Content.Lines()
Important: String literals themselves ARE case-sensitive:
"txt"≠"TXT"- Use
.toLower()or.toUpper()for case-insensitive string comparisons
File properties
You can access different file properties like name, extension, size and so on: See details in access docs.
Literal values
Literal values, i.e. Numbers, String, Booleans… can be written as is. For example, 2 represent the number two. See more details in:
Empty Values
In findit, an “empty” value represents the absence of data. This occurs when:
- A file cannot be read (no permissions, doesn’t exist)
- Content is not valid UTF-8
- An operation has no valid result
Empty values:
- Compare as empty to any value (including other empty values)
- Evaluate to
falsewithIS NONE - Can be checked with
IS SOME/IS NONEoperators
Binary operators
Binary operators are operators that appears between two expressions and apply to both of them. For example the plus (+) binary operator can be used to add two number like: 2 + 3 (which is two plus 3). See more details in:
Comparison operators
- Equals (
=or==) - Not Equals (
<>or!=) - Bigger than (
>) - Smaller than (
<) - Bigger than equals (
>=) - Smaller than equals (
<=)
Access operators
Numeric operators - arithmetic operators that apply on numeric operands
String operators
Date operators
Path operators
Boolean logical operators
Unary operators
Unary operators are operators that appears before or after an expression. For example, the negate (NOT) operator will negate a Boolean operand.
Postfix unary operators
Prefix unary operators
Is
The IS operators is used to verify that an operand is some types. The available operators are:
As
The AS operators is used to cast an operand to another type. The available castings are:
Parentheses
Parentheses (...) are used to wrap an expression in order to force its priority. That is, while ` 3 * 2 + 4 ` will be equals to 10, you can use 3 * (2 + 4) which will equal 18.
Expressions
If expression
You can use an IF expression to choose between two cases. See details in If docs.
Case expression
You can use a CASE expression to choose between more than two cases. See details in Case docs.
Between
You can use a BETWEEN expression to filter between two values. See details in Between docs.
With
You can use a WITH expression to reuse some values. See details in With docs.
List
You can create a list value using the [] syntax, for example: [10, 11] will be a list that contains 10 and 11. See details in List docs.
Class
You can create a class value using the {} syntax, for example: {:name "John", :age 61} will be a class with two fields, :name a string
with “John” and :age a number with 61. To access the :age filed, use {:name "John", :age 61}::age. See details in Class docs.
Functions
Functions can be used to invoke a function. For example, now() to give the current time or rand() to produce a random number.
environment functions
time functions
external process execution functions
string functions
Methods
Methods are functions over a specific operand. They can be invoke using the dot (or of) operator. They can also be
used without an operand to refer to the current file (i.e. lines() is the same as me.lines()). Methods without any arguments can be used without the open and closed parenthesis. That
is, you can use me.lines.length instead of me.lines().length().
String methods
- length
- toUpper
- toLower
- trim
- trimHead
- trimTail
- reverse
- take
- skip
- split
- lines
- words
- contains
- indexOf
- hasPrefix
- hasSuffix
- removePrefix
- removeSuffix
List methods
- length
- reverse
- map
- filter
- sum
- max
- min
- avg
- sort
- sortBy
- distinct
- distinctBy
- take
- skip
- join
- first
- last
- contains
- indexOf
- flatMap
- all
- any
- groupBy
- enumerate