SpConditioner 1.0.1
See the version list below for details.
dotnet add package SpConditioner --version 1.0.1
NuGet\Install-Package SpConditioner -Version 1.0.1
<PackageReference Include="SpConditioner" Version="1.0.1" />
paket add SpConditioner --version 1.0.1
#r "nuget: SpConditioner, 1.0.1"
// Install SpConditioner as a Cake Addin #addin nuget:?package=SpConditioner&version=1.0.1 // Install SpConditioner as a Cake Tool #tool nuget:?package=SpConditioner&version=1.0.1
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 | Versions 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. |
-
net8.0
- Sprache (>= 2.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.