Expressif 0.1.10

There is a newer version of this package available.
See the version list below for details.
dotnet add package Expressif --version 0.1.10
NuGet\Install-Package Expressif -Version 0.1.10
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Expressif" Version="0.1.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Expressif --version 0.1.10
#r "nuget: Expressif, 0.1.10"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Expressif as a Cake Addin
#addin nuget:?package=Expressif&version=0.1.10

// Install Expressif as a Cake Tool
#tool nuget:?package=Expressif&version=0.1.10

Expressif

Expressif is the variable substitution syntax, initially designed for NBi.io.

Expressif allows you to define variables and transformation of these variables (functions), in plain text, which can then be interpreted by the engine. The syntax for the definition of the expression transforming the variable is similar to:

@myVariable | text-to-lower | text-to-pad-right(@myCount, *)

Logo

About | Quickstart | Installing | Functions

About

Social media: twitter badge

Releases: nuget licence badge

Dev. activity: GitHub last commit Still maintained GitHub commit activity

Continuous integration builds: Build status Tests

Status: stars badge Bugs badge Features badge Top language

Quickstart

var factory = new ExpressionFactory();
var expression = factory.Instantiate("text-to-lower");
var result = expression.Execute("Nikola Tesla")
Debug.WriteLine(result); // returns "nikola tesla"

Some functions required arguments, you can specify them between the brackets after the function name. Note that literal textual values don't required quotes surronding the values.

var factory = new ExpressionFactory();
var expression = factory.Instantiate("text-to-remove-chars(a)");
var result = expression.Execute("Nikola Tesla")
Debug.WriteLine(result); // returns "Nikol Tesl"

You can chain the functions to apply to the initial value by using the operator pipe (|). The functions are executed from left to right.

var factory = new ExpressionFactory();
var expression = factory.Instantiate("text-to-lower | text-to-remove-chars(a)");
var result = expression.Execute("Nikola Tesla")
Debug.WriteLine(result); // returns "nikol tesl"

It's possible to use variables as function parameters. the name of the variables must always start by an arobas (@)

var context = new Context();
context.Variables.Add("myChar", 'k');

var factory = new ExpressionFactory(context);
var expression = factory.Instantiate("text-to-lower | text-to-remove-chars(@myChar)");
var result = expression.Execute("Nikola Tesla")
Debug.WriteLine(result); // returns "niola tesla"

In addition to the variables that must be scalar values (text, numeric, dateTime ...), you can also add a property-object to the context. An property-object can be a pure C# object, a Dictionnary, a List or a DataRow. You can access the properties of the property-object based on the property's name with the syntax [property-name]

var context = new Context();
context.PropertyObject.Set(new {CharToBeRemoved = 't'});

var factory = new ExpressionFactory(context);
var expression = factory.Instantiate("text-to-lower | text-to-remove-chars([CharToBeRemoved])");
var result = expression.Execute("Nikola Tesla")
Debug.WriteLine(result); // returns "nikola esla"

or based on its position with the syntax #index (where index is positive number).

var context = new Context();
context.PropertyObject.Set(new List() {'e', 's'});

var factory = new ExpressionFactory(context);
var expression = factory.Instantiate("text-to-lower | text-to-remove-chars(#1)");
var result = expression.Execute(""Nikola Tesla"")
Debug.WriteLine(result); // returns "nikola tela"

It's also possible to use a function's result as the value of a parameter for another function. To achieve this the function as a parameter must be surrounded by curly braces {...}

var context = new Context();
context.Variable.Add("myVar", 6)
context.PropertyObject.Set(new List() {15, 8, 3});

var factory = new ExpressionFactory(context);
var expression = factory.Instantiate("text-to-lower | text-to-skip-last-chars( {@myVar | numeric-to-subtract(#2) }));
var result = expression.Execute(""Nikola Tesla"")
Debug.WriteLine(result); // sub-function returns 6-3 = 3 and the main function returns "nikola te"

Installing

Install in the usual .NET fashion:

Install-Package Expressif

Functions

TBC

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.8.9 22 5/14/2024
1.8.8 97 3/18/2024
1.8.7 80 3/18/2024
1.8.6 97 3/16/2024
1.8.5 91 2/27/2024
1.8.4 95 2/22/2024
1.8.3 79 2/17/2024
1.8.2 91 2/4/2024
1.8.1 83 1/30/2024
1.8.0 109 1/13/2024
1.7.0 81 1/13/2024
1.6.2 89 1/11/2024
1.6.1 76 1/11/2024
1.6.0 106 1/7/2024
1.5.0 100 1/7/2024
1.4.8 97 1/6/2024
1.4.7 96 1/6/2024
1.4.5 107 1/6/2024
1.4.4 99 1/6/2024
1.4.3 112 1/1/2024
1.4.2 90 12/31/2023
1.4.1 102 12/30/2023
1.4.0 95 12/30/2023
1.3.0 97 12/29/2023
1.2.0 88 12/29/2023
1.1.2 98 12/28/2023
1.1.1 95 12/28/2023
1.1.0 95 12/27/2023
1.0.0 99 12/22/2023
0.8.0 88 12/22/2023
0.7.0 73 12/22/2023
0.6.0 98 12/22/2023
0.5.0 104 12/22/2023
0.4.0 104 12/21/2023
0.3.48 106 12/21/2023
0.3.47 146 12/5/2023
0.3.46 124 12/5/2023
0.3.45 106 12/5/2023
0.3.44 119 12/5/2023
0.3.43 121 12/3/2023
0.3.39 114 12/3/2023
0.3.36 132 11/9/2023
0.3.35 111 11/6/2023
0.3.34 142 9/2/2023
0.3.33 134 8/17/2023
0.3.32 162 8/14/2023
0.3.31 158 8/9/2023
0.3.30 144 8/9/2023
0.3.29 160 8/8/2023
0.3.28 174 7/1/2023
0.3.27 155 6/14/2023
0.3.25 204 3/7/2023
0.3.24 220 3/5/2023
0.3.23 205 3/5/2023
0.3.22 214 3/5/2023
0.3.21 212 3/5/2023
0.3.20 214 3/5/2023
0.3.18 286 1/3/2023
0.3.17 296 1/3/2023
0.3.15 283 12/31/2022
0.3.14 274 12/31/2022
0.3.13 274 12/30/2022
0.3.11 302 12/29/2022
0.3.9 271 12/29/2022
0.3.8 267 12/29/2022
0.3.7 294 12/29/2022
0.3.6 283 12/28/2022
0.3.5 279 12/28/2022
0.3.4 291 12/28/2022
0.3.3 282 12/28/2022
0.3.2 272 12/26/2022
0.3.1 289 12/26/2022
0.3.0 288 12/26/2022
0.2.26 288 12/24/2022
0.2.25 293 12/23/2022
0.2.24 294 12/22/2022
0.2.23 276 12/22/2022
0.2.22 293 12/21/2022
0.2.21 299 12/21/2022
0.2.20 312 12/19/2022
0.2.18 306 12/18/2022
0.2.15 299 12/18/2022
0.2.14 288 12/18/2022
0.2.13 283 12/18/2022
0.2.12 297 12/18/2022
0.2.9 293 12/11/2022
0.2.8 280 12/11/2022
0.2.7 273 12/10/2022
0.2.6 289 12/10/2022
0.2.5 285 12/10/2022
0.2.4 302 12/6/2022
0.2.3 288 12/6/2022
0.2.2 320 11/26/2022
0.2.1 325 11/22/2022
0.2.0 312 11/21/2022
0.1.17 327 11/17/2022
0.1.16 331 11/15/2022
0.1.15 361 11/13/2022
0.1.13 349 11/12/2022
0.1.11 317 11/12/2022
0.1.10 318 11/12/2022
0.1.7 337 11/12/2022
0.1.6 337 11/12/2022