# ParseMethod

Applies to:
Class:uCalc
Parses an expression that will later be evaluated with Evaluate or EvaluateStr
Syntax
Parse(Expression, DataType)
Parameters
Expression
String
Expression to be parsed
DataType
String
(Default = 0)
Data type of return value
Returns
Parses an expression that will later be evaluated with Evaluate or EvaluateStr
Remarks
Example 1: Displaying a different result for each value of x based on the expression parsed with Parse
``` Dim VariableX = uc.DefineVariable("x") Dim Expression As string Console.Write("Enter an expression (Ex: x^2 * 10): ") Expression = Console.ReadLine() Dim ParsedExpr = uc.Parse(Expression) Dim x As double for x = 1 To 10 VariableX.SetVariableValue(x) Console.WriteLine("x = " + x + " Result = " + ParsedExpr.Evaluate()) Next ' Output ' x = 1 Result = 10 ' x = 2 Result = 40 ' x = 3 Result = 90 ' x = 4 Result = 160 ' x = 5 Result = 250 ' x = 6 Result = 360 ' x = 7 Result = 490 ' x = 8 Result = 640 ' x = 9 Result = 810 ' x = 10 Result = 1000 ParsedExpr.Release() VariableX.Release() ```
``` var VariableX = uc.DefineVariable("x"); string Expression; Console.Write("Enter an expression (Ex: x^2 * 10): "); Expression = Console.ReadLine(); var ParsedExpr = uc.Parse(Expression); for (double x = 1; x <= 10; x = x + 1) { VariableX.SetVariableValue(x); Console.WriteLine("x = " + x + " Result = " + ParsedExpr.Evaluate()); } // Output // x = 1 Result = 10 // x = 2 Result = 40 // x = 3 Result = 90 // x = 4 Result = 160 // x = 5 Result = 250 // x = 6 Result = 360 // x = 7 Result = 490 // x = 8 Result = 640 // x = 9 Result = 810 // x = 10 Result = 1000 ParsedExpr.Release(); VariableX.Release(); ```
``` //var VariableX = uc.DefineVariable('x'); Write('Enter an expression (Ex: x^2 * 10): ') Expression = ReadLn(); //var ParsedExpr = uc.Parse(Expression); for x := 1 to 10 do begin VariableX.SetVariableValue(x); WriteLn('x = ' + x + ' Result = ' + ParsedExpr.Evaluate()); End; // Output // x = 1 Result = 10 // x = 2 Result = 40 // x = 3 Result = 90 // x = 4 Result = 160 // x = 5 Result = 250 // x = 6 Result = 360 // x = 7 Result = 490 // x = 8 Result = 640 // x = 9 Result = 810 // x = 10 Result = 1000 ParsedExpr.Release(); VariableX.Release(); ```
``` auto VariableX = uc.DefineVariable("x"); string Expression; cout << "Enter an expression (Ex: x^2 * 10): " << endl; cin >> Expression; // Ex: x^2 * 10 auto ParsedExpr = uc.Parse(Expression); for (double x = 1; x <= 10; x = x + 1) { VariableX.SetVariableValue(x); cout << "x = " << x << " Result = " << ParsedExpr.Evaluate() << endl; } // Output // x = 1 Result = 10 // x = 2 Result = 40 // x = 3 Result = 90 // x = 4 Result = 160 // x = 5 Result = 250 // x = 6 Result = 360 // x = 7 Result = 490 // x = 8 Result = 640 // x = 9 Result = 810 // x = 10 Result = 1000 ParsedExpr.Release(); VariableX.Release(); ```
``` auto VariableX = uc.DefineVariable("x"); string ^ Expression; Console::Write("Enter an expression (Ex: x^2 * 10): "); Expression = Console::ReadLine(); auto ParsedExpr = uc.Parse(Expression); for (double x = 1; x <= 10; x = x + 1) { VariableX.SetVariableValue(x); Console::WriteLine("x = " + x + " Result = " + ParsedExpr.Evaluate()); } // Output // x = 1 Result = 10 // x = 2 Result = 40 // x = 3 Result = 90 // x = 4 Result = 160 // x = 5 Result = 250 // x = 6 Result = 360 // x = 7 Result = 490 // x = 8 Result = 640 // x = 9 Result = 810 // x = 10 Result = 1000 ParsedExpr.Release(); VariableX.Release(); ```
Example 2: Displaying a different Integer (Int32) result for each value of x based on the expression parsed with Parse
``` Dim VariableX = uc.DefineVariable("x") Dim Expression As string Console.Write("Enter an expression (Ex: x / 2): ") Expression = Console.ReadLine() Dim ParsedExpr = uc.Parse(Expression, "Integer"): ' NOTE: Expression must be parsed as a 32-bit integer for EvaluateInt32 to work; Dim x As double for x = 1 To 10 VariableX.SetVariableValue(x) Console.WriteLine("x = " + x + " Result = " + ParsedExpr.EvaluateInt32()) Next ' Output ' x = 1 Result = 0 ' x = 2 Result = 1 ' x = 3 Result = 1 ' x = 4 Result = 2 ' x = 5 Result = 2 ' x = 6 Result = 3 ' x = 7 Result = 3 ' x = 8 Result = 4 ' x = 9 Result = 4 ' x = 10 Result = 5 ```
``` var VariableX = uc.DefineVariable("x"); string Expression; Console.Write("Enter an expression (Ex: x / 2): "); Expression = Console.ReadLine(); var ParsedExpr = uc.Parse(Expression, "Integer"); // NOTE: Expression must be parsed as a 32-bit integer for EvaluateInt32 to work; for (double x = 1; x <= 10; x = x + 1) { VariableX.SetVariableValue(x); Console.WriteLine("x = " + x + " Result = " + ParsedExpr.EvaluateInt32()); } // Output // x = 1 Result = 0 // x = 2 Result = 1 // x = 3 Result = 1 // x = 4 Result = 2 // x = 5 Result = 2 // x = 6 Result = 3 // x = 7 Result = 3 // x = 8 Result = 4 // x = 9 Result = 4 // x = 10 Result = 5 ParsedExpr.Release(); VariableX.Release(); ```
``` //var VariableX = uc.DefineVariable('x'); Write('Enter an expression (Ex: x / 2): ') Expression = ReadLn(); //var ParsedExpr = uc.Parse(Expression, 'Integer'); // NOTE: Expression must be parsed as a 32-bit integer for EvaluateInt32 to work; for x := 1 to 10 do begin VariableX.SetVariableValue(x); WriteLn('x = ' + x + ' Result = ' + ParsedExpr.EvaluateInt32()); End; // Output // x = 1 Result = 0 // x = 2 Result = 1 // x = 3 Result = 1 // x = 4 Result = 2 // x = 5 Result = 2 // x = 6 Result = 3 // x = 7 Result = 3 // x = 8 Result = 4 // x = 9 Result = 4 // x = 10 Result = 5 ```
``` auto VariableX = uc.DefineVariable("x"); string Expression; cout << "Enter an expression (Ex: x / 2): " << endl; cin >> Expression; // Ex: x / 2 auto ParsedExpr = uc.Parse(Expression, "Integer"); // NOTE: Expression must be parsed as a 32-bit integer for EvaluateInt32 to work; for (double x = 1; x <= 10; x = x + 1) { VariableX.SetVariableValue(x); cout << "x = " << x << " Result = " << ParsedExpr.EvaluateInt32() << endl; } // Output // x = 1 Result = 0 // x = 2 Result = 1 // x = 3 Result = 1 // x = 4 Result = 2 // x = 5 Result = 2 // x = 6 Result = 3 // x = 7 Result = 3 // x = 8 Result = 4 // x = 9 Result = 4 // x = 10 Result = 5 ParsedExpr.Release(); VariableX.Release(); ```
``` auto VariableX = uc.DefineVariable("x"); string ^ Expression; Console::Write("Enter an expression (Ex: x / 2): "); Expression = Console::ReadLine(); auto ParsedExpr = uc.Parse(Expression, "Integer"); // NOTE: Expression must be parsed as a 32-bit integer for EvaluateInt32 to work; for (double x = 1; x <= 10; x = x + 1) { VariableX.SetVariableValue(x); Console::WriteLine("x = " + x + " Result = " + ParsedExpr.EvaluateInt32()); } // Output // x = 1 Result = 0 // x = 2 Result = 1 // x = 3 Result = 1 // x = 4 Result = 2 // x = 5 Result = 2 // x = 6 Result = 3 // x = 7 Result = 3 // x = 8 Result = 4 // x = 9 Result = 4 // x = 10 Result = 5 ParsedExpr.Release(); VariableX.Release(); ```
Example 3: displaying each character of a string on a separate line
``` Dim MyString As string Console.Write("Enter an expression (Ex: 'This is a Test'): ") MyString = Console.ReadLine() Dim VariableX = uc.DefineVariable("x As Int32") Dim MyStringVar = uc.DefineVariable("MyStringVar As String = " + MyString) Dim ParsedExpr = uc.Parse("Substr(MyStringVar, x, 1)") Dim StrLength = uc.Eval("Length(MyStringVar)") Dim x As Int32 for x = 0 To StrLength-1 VariableX.SetVariableValueInt32(x) Console.WriteLine(ParsedExpr.EvaluateStr()) Next ' Output ' T ' h ' i ' s ' ' i ' s ' ' a ' ' T ' e ' s ' t ```
``` string MyString; Console.Write("Enter an expression (Ex: 'This is a Test'): "); MyString = Console.ReadLine(); var VariableX = uc.DefineVariable("x As Int32"); var MyStringVar = uc.DefineVariable("MyStringVar As String = " + MyString); var ParsedExpr = uc.Parse("Substr(MyStringVar, x, 1)"); var StrLength = uc.Eval("Length(MyStringVar)"); for (Int32 x = 0; x <= StrLength-1; x++) { VariableX.SetVariableValueInt32(x); Console.WriteLine(ParsedExpr.EvaluateStr()); } // Output // T // h // i // s // // i // s // // a // // T // e // s // t ```
``` Write('Enter an expression (Ex: "This is a Test"): ') MyString = ReadLn(); //var VariableX = uc.DefineVariable('x As Int32'); //var MyStringVar = uc.DefineVariable('MyStringVar As String = ' + MyString); //var ParsedExpr = uc.Parse('Substr(MyStringVar, x, 1)'); //var StrLength = uc.Eval('Length(MyStringVar)'); for x := 0 to StrLength-1 do begin VariableX.SetVariableValueInt32(x); WriteLn(ParsedExpr.EvaluateStr()); End; // Output // T // h // i // s // // i // s // // a // // T // e // s // t ```
``` string MyString; cout << "Enter an expression (Ex: 'This is a Test'): " << endl; cin >> MyString; // Ex: 'This is a Test' auto VariableX = uc.DefineVariable("x As Int32"); auto MyStringVar = uc.DefineVariable("MyStringVar As String = " + MyString); auto ParsedExpr = uc.Parse("Substr(MyStringVar, x, 1)"); auto StrLength = uc.Eval("Length(MyStringVar)"); for (int x = 0; x <= StrLength-1; x++) { VariableX.SetVariableValueInt32(x); cout << ParsedExpr.EvaluateStr() << endl; } // Output // T // h // i // s // // i // s // // a // // T // e // s // t ```
``` string ^ MyString; Console::Write("Enter an expression (Ex: 'This is a Test'): "); MyString = Console::ReadLine(); auto VariableX = uc.DefineVariable("x As Int32"); auto MyStringVar = uc.DefineVariable("MyStringVar As String = " + MyString); auto ParsedExpr = uc.Parse("Substr(MyStringVar, x, 1)"); auto StrLength = uc.Eval("Length(MyStringVar)"); for (int x = 0; x <= StrLength-1; x++) { VariableX.SetVariableValueInt32(x); Console::WriteLine(ParsedExpr.EvaluateStr()); } // Output // T // h // i // s // // i // s // // a // // T // e // s // t ```
Example 4: Displaying a different complex number result for each value of x based on the expression parsed with Parse
``` Dim x As double Dim VariableX = uc.DefineVariable("x") Dim Expression As string Console.Write("Enter an expression (Ex: x * #i + 5): ") Expression = Console.ReadLine() Dim ParsedExpr = uc.Parse(Expression, "Complex"): ' NOTE: EvaluateStr works with any data type; for x = 1 To 10 VariableX.SetVariableValue(x) Console.WriteLine("x = " + x + " Result = " + ParsedExpr.EvaluateStr()) Next ' Output ' x = 1 Result = 5+1i ' x = 2 Result = 5+2i ' x = 3 Result = 5+3i ' x = 4 Result = 5+4i ' x = 5 Result = 5+5i ' x = 6 Result = 5+6i ' x = 7 Result = 5+7i ' x = 8 Result = 5+8i ' x = 9 Result = 5+9i ' x = 10 Result = 5+10i ParsedExpr.Release() VariableX.Release() ```
``` double x; var VariableX = uc.DefineVariable("x"); string Expression; Console.Write("Enter an expression (Ex: x * #i + 5): "); Expression = Console.ReadLine(); var ParsedExpr = uc.Parse(Expression, "Complex"); // NOTE: EvaluateStr works with any data type; for (x = 1; x <= 10; x = x + 1) { VariableX.SetVariableValue(x); Console.WriteLine("x = " + x + " Result = " + ParsedExpr.EvaluateStr()); } // Output // x = 1 Result = 5+1i // x = 2 Result = 5+2i // x = 3 Result = 5+3i // x = 4 Result = 5+4i // x = 5 Result = 5+5i // x = 6 Result = 5+6i // x = 7 Result = 5+7i // x = 8 Result = 5+8i // x = 9 Result = 5+9i // x = 10 Result = 5+10i ParsedExpr.Release(); VariableX.Release(); ```
``` //var x: Double; //var VariableX = uc.DefineVariable('x'); Write('Enter an expression (Ex: x * #i + 5): ') Expression = ReadLn(); //var ParsedExpr = uc.Parse(Expression, 'Complex'); // NOTE: EvaluateStr works with any data type; for x := 1 to 10 do begin VariableX.SetVariableValue(x); WriteLn('x = ' + x + ' Result = ' + ParsedExpr.EvaluateStr()); End; // Output // x = 1 Result = 5+1i // x = 2 Result = 5+2i // x = 3 Result = 5+3i // x = 4 Result = 5+4i // x = 5 Result = 5+5i // x = 6 Result = 5+6i // x = 7 Result = 5+7i // x = 8 Result = 5+8i // x = 9 Result = 5+9i // x = 10 Result = 5+10i ParsedExpr.Release(); VariableX.Release(); ```
``` double x; auto VariableX = uc.DefineVariable("x"); string Expression; cout << "Enter an expression (Ex: x * #i + 5): " << endl; cin >> Expression; // Ex: x * #i + 5 auto ParsedExpr = uc.Parse(Expression, "Complex"); // NOTE: EvaluateStr works with any data type; for (x = 1; x <= 10; x = x + 1) { VariableX.SetVariableValue(x); cout << "x = " << x << " Result = " << ParsedExpr.EvaluateStr() << endl; } // Output // x = 1 Result = 5+1i // x = 2 Result = 5+2i // x = 3 Result = 5+3i // x = 4 Result = 5+4i // x = 5 Result = 5+5i // x = 6 Result = 5+6i // x = 7 Result = 5+7i // x = 8 Result = 5+8i // x = 9 Result = 5+9i // x = 10 Result = 5+10i ParsedExpr.Release(); VariableX.Release(); ```
``` double x; auto VariableX = uc.DefineVariable("x"); string ^ Expression; Console::Write("Enter an expression (Ex: x * #i + 5): "); Expression = Console::ReadLine(); auto ParsedExpr = uc.Parse(Expression, "Complex"); // NOTE: EvaluateStr works with any data type; for (x = 1; x <= 10; x = x + 1) { VariableX.SetVariableValue(x); Console::WriteLine("x = " + x + " Result = " + ParsedExpr.EvaluateStr()); } // Output // x = 1 Result = 5+1i // x = 2 Result = 5+2i // x = 3 Result = 5+3i // x = 4 Result = 5+4i // x = 5 Result = 5+5i // x = 6 Result = 5+6i // x = 7 Result = 5+7i // x = 8 Result = 5+8i // x = 9 Result = 5+9i // x = 10 Result = 5+10i ParsedExpr.Release(); VariableX.Release(); ```
Example 5: Displaying an expression of unsigned byte as a signed byte by using a Pointer
``` Dim VariableX = uc.DefineVariable("x As Int") Dim Expression As string Console.Write("Enter an expression (Ex: x + 125): ") Expression = Console.ReadLine() Dim ParsedExpr = uc.Parse(Expression, "Int8u") Dim x As Int32 for x = 1 To 10 VariableX.SetVariableValueInt32(x) Console.WriteLine("x = " + x + " Int8 result = " + uc.ValueAt(ParsedExpr.EvaluateVoid(), "Int8")) Next ' Output ' x = 1 Int8 result = 126 ' x = 2 Int8 result = 127 ' x = 3 Int8 result = -128 ' x = 4 Int8 result = -127 ' x = 5 Int8 result = -126 ' x = 6 Int8 result = -125 ' x = 7 Int8 result = -124 ' x = 8 Int8 result = -123 ' x = 9 Int8 result = -122 ' x = 10 Int8 result = -121 ```
``` var VariableX = uc.DefineVariable("x As Int"); string Expression; Console.Write("Enter an expression (Ex: x + 125): "); Expression = Console.ReadLine(); var ParsedExpr = uc.Parse(Expression, "Int8u"); for (Int32 x = 1; x <= 10; x++) { VariableX.SetVariableValueInt32(x); Console.WriteLine("x = " + x + " Int8 result = " + uc.ValueAt(ParsedExpr.EvaluateVoid(), "Int8")); } // Output // x = 1 Int8 result = 126 // x = 2 Int8 result = 127 // x = 3 Int8 result = -128 // x = 4 Int8 result = -127 // x = 5 Int8 result = -126 // x = 6 Int8 result = -125 // x = 7 Int8 result = -124 // x = 8 Int8 result = -123 // x = 9 Int8 result = -122 // x = 10 Int8 result = -121 ParsedExpr.Release(); VariableX.Release(); ```
``` //var VariableX = uc.DefineVariable('x As Int'); Write('Enter an expression (Ex: x + 125): ') Expression = ReadLn(); //var ParsedExpr = uc.Parse(Expression, 'Int8u'); for x := 1 to 10 do begin VariableX.SetVariableValueInt32(x); WriteLn('x = ' + x + ' Int8 result = ' + uc.ValueAt(ParsedExpr.EvaluateVoid(), 'Int8')); End; // Output // x = 1 Int8 result = 126 // x = 2 Int8 result = 127 // x = 3 Int8 result = -128 // x = 4 Int8 result = -127 // x = 5 Int8 result = -126 // x = 6 Int8 result = -125 // x = 7 Int8 result = -124 // x = 8 Int8 result = -123 // x = 9 Int8 result = -122 // x = 10 Int8 result = -121 ```
``` auto VariableX = uc.DefineVariable("x As Int"); string Expression; cout << "Enter an expression (Ex: x + 125): " << endl; cin >> Expression; // Ex: x + 125 auto ParsedExpr = uc.Parse(Expression, "Int8u"); for (int x = 1; x <= 10; x++) { VariableX.SetVariableValueInt32(x); cout << "x = " << x << " Int8 result = " << uc.ValueAt(ParsedExpr.EvaluateVoid(), "Int8") << endl; } // Output // x = 1 Int8 result = 126 // x = 2 Int8 result = 127 // x = 3 Int8 result = -128 // x = 4 Int8 result = -127 // x = 5 Int8 result = -126 // x = 6 Int8 result = -125 // x = 7 Int8 result = -124 // x = 8 Int8 result = -123 // x = 9 Int8 result = -122 // x = 10 Int8 result = -121 ParsedExpr.Release(); VariableX.Release(); ```
``` auto VariableX = uc.DefineVariable("x As Int"); string ^ Expression; Console::Write("Enter an expression (Ex: x + 125): "); Expression = Console::ReadLine(); auto ParsedExpr = uc.Parse(Expression, "Int8u"); for (int x = 1; x <= 10; x++) { VariableX.SetVariableValueInt32(x); Console::WriteLine("x = " + x + " Int8 result = " + uc.ValueAt(ParsedExpr.EvaluateVoid(), "Int8")); } // Output // x = 1 Int8 result = 126 // x = 2 Int8 result = 127 // x = 3 Int8 result = -128 // x = 4 Int8 result = -127 // x = 5 Int8 result = -126 // x = 6 Int8 result = -125 // x = 7 Int8 result = -124 // x = 8 Int8 result = -123 // x = 9 Int8 result = -122 // x = 10 Int8 result = -121 ParsedExpr.Release(); VariableX.Release(); ```
Example 6: Performing a summation; a return value is needed only at the very end
``` Dim VariableX = uc.DefineVariable("x") Dim Total = uc.DefineVariable("Total") Dim Expression As string Console.Write("Enter an expression (Ex: Total = Total + x^2 + 5): ") Expression = Console.ReadLine() Dim ParsedExpr = uc.Parse(Expression) Dim x As double for x = 1 To 10 VariableX.SetVariableValue(x) ParsedExpr.Execute() Console.WriteLine(uc.Eval("x") + " Sub total = " + uc.Eval("Total")) Next ' Output ' 1 Sub total = 6 ' 2 Sub total = 15 ' 3 Sub total = 29 ' 4 Sub total = 50 ' 5 Sub total = 80 ' 6 Sub total = 121 ' 7 Sub total = 175 ' 8 Sub total = 244 ' 9 Sub total = 330 ' 10 Sub total = 435 ```
``` var VariableX = uc.DefineVariable("x"); var Total = uc.DefineVariable("Total"); string Expression; Console.Write("Enter an expression (Ex: Total = Total + x^2 + 5): "); Expression = Console.ReadLine(); var ParsedExpr = uc.Parse(Expression); for (double x = 1; x <= 10; x = x + 1) { VariableX.SetVariableValue(x); ParsedExpr.Execute(); Console.WriteLine(uc.Eval("x") + " Sub total = " + uc.Eval("Total")); } // Output // 1 Sub total = 6 // 2 Sub total = 15 // 3 Sub total = 29 // 4 Sub total = 50 // 5 Sub total = 80 // 6 Sub total = 121 // 7 Sub total = 175 // 8 Sub total = 244 // 9 Sub total = 330 // 10 Sub total = 435 Console.WriteLine("Total = " + uc.Eval("Total")); // Returns "Total = 435"; ParsedExpr.Release(); VariableX.Release(); ```
``` //var VariableX = uc.DefineVariable('x'); //var Total = uc.DefineVariable('Total'); Write('Enter an expression (Ex: Total = Total + x^2 + 5): ') Expression = ReadLn(); //var ParsedExpr = uc.Parse(Expression); for x := 1 to 10 do begin VariableX.SetVariableValue(x); ParsedExpr.Execute(); WriteLn(uc.Eval('x') + ' Sub total = ' + uc.Eval('Total')); End; // Output // 1 Sub total = 6 // 2 Sub total = 15 // 3 Sub total = 29 // 4 Sub total = 50 // 5 Sub total = 80 // 6 Sub total = 121 // 7 Sub total = 175 // 8 Sub total = 244 // 9 Sub total = 330 // 10 Sub total = 435 ```
``` auto VariableX = uc.DefineVariable("x"); auto Total = uc.DefineVariable("Total"); string Expression; cout << "Enter an expression (Ex: Total = Total + x^2 + 5): " << endl; cin >> Expression; // Ex: Total = Total + x^2 + 5 auto ParsedExpr = uc.Parse(Expression); for (double x = 1; x <= 10; x = x + 1) { VariableX.SetVariableValue(x); ParsedExpr.Execute(); cout << uc.Eval("x") << " Sub total = " << uc.Eval("Total") << endl; } // Output // 1 Sub total = 6 // 2 Sub total = 15 // 3 Sub total = 29 // 4 Sub total = 50 // 5 Sub total = 80 // 6 Sub total = 121 // 7 Sub total = 175 // 8 Sub total = 244 // 9 Sub total = 330 // 10 Sub total = 435 cout << "Total = " << uc.Eval("Total") << endl; // Returns "Total = 435"; ParsedExpr.Release(); VariableX.Release(); ```
``` auto VariableX = uc.DefineVariable("x"); auto Total = uc.DefineVariable("Total"); string ^ Expression; Console::Write("Enter an expression (Ex: Total = Total + x^2 + 5): "); Expression = Console::ReadLine(); auto ParsedExpr = uc.Parse(Expression); for (double x = 1; x <= 10; x = x + 1) { VariableX.SetVariableValue(x); ParsedExpr.Execute(); Console::WriteLine(uc.Eval("x") + " Sub total = " + uc.Eval("Total")); } // Output // 1 Sub total = 6 // 2 Sub total = 15 // 3 Sub total = 29 // 4 Sub total = 50 // 5 Sub total = 80 // 6 Sub total = 121 // 7 Sub total = 175 // 8 Sub total = 244 // 9 Sub total = 330 // 10 Sub total = 435 Console::WriteLine("Total = " + uc.Eval("Total")); // Returns "Total = 435"; ParsedExpr.Release(); VariableX.Release(); ```
DLL import code
``` <DllImport(uCalcDLL, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="Parse")> _ Private Function Parse__(ByVal uCalcHandle As IntPtr,ByVal Expression As String , ByVal DataType As String ) As IntPtr End Function ```
``` [DllImport(uCalcDLL, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl, EntryPoint="Parse")] protected static extern IntPtr Parse_(IntPtr uCalcHandle, string Expression , string DataType ); ```
``` {DLLImport}function Parse__(uCalcHandle: System.Pointer;Expression: AnsiString ; DataType: AnsiString): System.Pointer; cdecl; external uCalcDLL name 'Parse'; ```
``` typedef uCalcPtr (* __Parse)(void *uCalcHandle, CONSTCHAR Expression , CONSTCHAR DataType ); ```
``` [DllImport(uCalcLib, CharSet=CharSet::Ansi, CallingConvention=CallingConvention::Cdecl, EntryPoint = "Parse")] static uCalcPtr Parse_(void * uCalcHandle, MARSHALSTR Expression , MARSHALSTR DataType); ```