OperatorConverter.ToValue(string) - YiZhang-Paul/Mock_Up_Calculator GitHub Wiki

Namespace: ConverterClassLibrary

Description: Maps an operator to numeric value.

Parameters Description
token<string> operator to convert
Returns Description
int non-negative values for valid operators, -1 otherwise

Examples:

string[] operators = { "+", "-", "!" };
var converter = new OperatorConverter(operators, null);

Console.WriteLine(converter.ToValue("+")); //0
Console.WriteLine(converter.ToValue("-")); //1
Console.WriteLine(converter.ToValue("!")); //2
Console.WriteLine(converter.ToValue("%")); //-1
⚠️ **GitHub.com Fallback** ⚠️