# Expressions: Functions

<table data-header-hidden><thead><tr><th>Name</th><th>Description</th><th width="168">Usage</th><th width="156">Result</th></tr></thead><tbody><tr><td>Name</td><td>Description</td><td>Usage</td><td>Result</td></tr><tr><td><strong>Abs</strong></td><td>Returns the absolute value of a specified number.</td><td>Abs(-1)</td><td>1M</td></tr><tr><td><strong>Acos</strong></td><td>Returns the angle whose cosine is the specified number.</td><td>Acos(1)</td><td>0d</td></tr><tr><td><strong>Asin</strong></td><td>Returns the angle whose sine is the specified number.</td><td>Asin(0)</td><td>0d</td></tr><tr><td><strong>Atan</strong></td><td>Returns the angle whose tangent is the specified number.</td><td>Atan(0)</td><td>0d</td></tr><tr><td><strong>Ceiling</strong></td><td>Returns the smallest integer greater than or equal to the specified number.</td><td>Ceiling(1.5)</td><td>2d</td></tr><tr><td><strong>Cos</strong></td><td>Returns the cosine of the specified angle.</td><td>Cos(0)</td><td>1d</td></tr><tr><td><strong>Exp</strong></td><td>Returns e raised to the specified power.</td><td>Exp(0)</td><td>1d</td></tr><tr><td><strong>Floor</strong></td><td>Returns the largest integer less than or equal to the specified number.</td><td>Floor(1.5)</td><td>1d</td></tr><tr><td><strong>IEEERemainder</strong></td><td>Returns the remainder resulting from the division of a specified number by another specified number.</td><td>IEEERemainder(3, 2)</td><td>-1d</td></tr><tr><td><strong>Log</strong></td><td>Returns the logarithm of a specified number.</td><td>Log(1, 10)</td><td>0d</td></tr><tr><td><strong>Log10</strong></td><td>Returns the base 10 logarithm of a specified number.</td><td>Log10(1)</td><td>0d</td></tr><tr><td><strong>Max</strong></td><td>Returns the larger of two specified numbers.</td><td>Max(1, 2)</td><td>2</td></tr><tr><td><strong>Min</strong></td><td>Returns the smaller of two numbers.</td><td>Min(1, 2)</td><td>1</td></tr><tr><td><strong>Pow</strong></td><td>Returns a specified number raised to the specified power.</td><td>Pow(3, 2)</td><td>9d</td></tr><tr><td><strong>Round</strong></td><td>Rounds a value to the nearest integer or specified number of decimal places. The mid number behaviour can be changed by using EvaluateOption.RoundAwayFromZero during construction of the Expression object.</td><td>Round(3.222, 2)</td><td>3.22d</td></tr><tr><td><strong>Sign</strong></td><td>Returns a value indicating the sign of a number.</td><td>Sign(-10)</td><td>-1</td></tr><tr><td><strong>Sin</strong></td><td>Returns the sine of the specified angle.</td><td>Sin(0)</td><td>0d</td></tr><tr><td><strong>Sqrt</strong></td><td>Returns the square root of a specified number.</td><td>Sqrt(4)</td><td>2d</td></tr><tr><td><strong>Tan</strong></td><td>Returns the tangent of the specified angle.</td><td>Tan(0)</td><td>0d</td></tr><tr><td><strong>Truncate</strong></td><td>Calculates the integral part of a number.</td><td>Truncate(1.7)</td><td>1</td></tr><tr><td><strong>Timespan</strong></td><td>Takes a number and interprets it a a timespan in milliseconds</td><td>Timespan(1000)</td><td>00:00:01.00</td></tr><tr><td><strong>ToNumber</strong></td><td>Converts the argument into a number (e.g. if it's a string)</td><td><p>ToNumber('100')</p><p>ToNumber([SIMCONNECT:ATC])</p></td><td></td></tr><tr><td><strong>ToString</strong></td><td>Converts the argument into a string</td><td></td><td></td></tr><tr><td>ToChar</td><td>Convert argument to a char</td><td>ToChar(int)</td><td></td></tr><tr><td><strong>GetValue</strong></td><td>Get the Value of the Reference the argument is pointing to.</td><td>GetValue('SIMCONNECT:ATC')</td><td></td></tr><tr><td><strong>Format</strong></td><td>Formats argument-1 using the formating rule argument-2</td><td>Format( 123.2356 , '0.00' )</td><td>123.23</td></tr><tr><td><strong>SubStr</strong></td><td>Extracts a subsctring SubStr(value, startIndex, [length])<br>Startindex can be negative to start at end</td><td></td><td></td></tr><tr><td><strong>Len</strong></td><td>Gets the Length of the argument as string</td><td></td><td></td></tr><tr><td>Concat</td><td>Concat a list of values to a string</td><td>Concat(val1,val2,val2,val3)</td><td></td></tr><tr><td><strong>ToBCO16</strong></td><td>Convert argument to BCO16</td><td></td><td></td></tr><tr><td><strong>FromBCO16</strong></td><td>Convert argument from a number to BCO16</td><td></td><td></td></tr><tr><td>ToBCD / FromBCD</td><td>Convert to/from BCD (Com frequencies) format</td><td></td><td></td></tr><tr><td><strong>Select</strong></td><td>Select a indexed value (index) from argumentlist (haystack)</td><td>Select([SIMCONNECT:SOMEPOSVAR],90,180,270,275)</td><td>Select(index,haystackevaluelist)</td></tr><tr><td>Rescale</td><td>Rescale a value linear from inMin...inMax to outMin..outMax</td><td>Rescale(value,inMin,inMax,outMin,outMax)</td><td></td></tr><tr><td>Count</td><td>Counts the number of occurences of a character in a string</td><td>Count(value,char)</td><td></td></tr><tr><td>Random</td><td>Create a Random number</td><td>Random()<br>Random(max)<br>Random(min,max)</td><td></td></tr><tr><td>In</td><td>Is a value in a list?</td><td>In(value,v1,v2,v3...)</td><td>if ( In([LOCAL:WINDDIRECTION],'North','East','West','South'), "Yeah" , "Invalid )</td></tr><tr><td>Replace (case-sensitive)</td><td>Replace all occourences of a string</td><td>Replace(input,old,new)</td><td>Replace('MyCoolString','Cool','Nice')</td></tr><tr><td>Replace (case insensitive)</td><td>Replace all occourences of a string (case insensitive)</td><td>Replace(input,old,new,1)</td><td>Replace('MycoolString','Cool','Nice',true)</td></tr><tr><td>IsMatch</td><td>Does string match a regular expression?</td><td>IsMatch(input,regex)</td><td>IsMatch('MyCoolString','.*Cool.*')</td></tr><tr><td>IndexOf (case-sensitive)</td><td>Find first occourence of a string (0 based, -1 if not found)</td><td>IndexOf(stringWhat,stringWhere)</td><td>IndexOf('cool','mycoolstring') = 2<br>IndexOf('cool','myCOOLstring') = -1</td></tr><tr><td>IndexOf (case-insensitive)</td><td>Find first occourence of a string (0 based, -1 if not found)</td><td>IndexOf(stringWhat,stringWhere,bool)</td><td>IndexOf('cool','myCOOLString',1) = 2</td></tr><tr><td>IsEmpty</td><td>Check if string is empty</td><td>IsEmpty('')<br>IsEmpty([LOCAL:PAGEID])</td><td></td></tr><tr><td>IsNotEmpty</td><td>Check if string is not empty</td><td>IsNotEmpty('')<br>IsNotEmpty([LOCAL:PAGEID])</td><td></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spadnext.com/features/expressions/functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
