SpConditioner 1.0.3

dotnet add package SpConditioner --version 1.0.3                
NuGet\Install-Package SpConditioner -Version 1.0.3                
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="SpConditioner" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SpConditioner --version 1.0.3                
#r "nuget: SpConditioner, 1.0.3"                
#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 SpConditioner as a Cake Addin
#addin nuget:?package=SpConditioner&version=1.0.3

// Install SpConditioner as a Cake Tool
#tool nuget:?package=SpConditioner&version=1.0.3                

This package is a parsing library for simplified expressions with variables, similar to conditional expressions in if statements.

Usage

Basic Usage

Use the StatementParser.ParseToBool function to parse a statement and get the result as a bool value.

using SpConditioner;

var statement = "2 * 3 == 6";
var result = StatementParser.ParseToBool(statement);
Assert.AreEqual(result, true);  // 2 * 3 == 6 => true

Working with Variables

To work with variables, first implement a class that adheres to the IVariableAccessor interface. For convenience, a VariableDictionary class, which extends Dictionary, is provided.

var dic = new VariableDictionary();
dic["two"] = 2;
dic["three"] = 3;
statement = "two + three == 5";
result = StatementParser.ParseToBool(statement, dic);
Assert.AreEqual(result, true);  // 2 + 3 == 5 => true

dic["flag_1"] = true;
dic["flag_2"] = false;
statement = "flag_1 && flag_2";
result = StatementParser.ParseToBool(statement, dic);
Assert.AreEqual(result, false); // true && false => false

Issues and Feedback

If you encounter any issues or have feature requests, please open an issue on our GitHub repository.

Issues: https://github.com/spi8823/SpConditioner/issues We appreciate your feedback and will do our best to address any concerns.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.0.3 104 9/15/2024
1.0.2 100 9/15/2024
1.0.1 109 9/15/2024
1.0.0 102 9/15/2024