# TextMethod

Applies to:Fast Math Parser
Class:uCalc.Item
Returns the text data associated with a uCalc.Item
Syntax
Text()
Remarks
Certain items, such as a syntax construct defined with DefineSyntax have a text property that can be retrieved with a call to this function.
Example 1: returning data type names for the different definitions of the "+" operator
``` Dim PlusOperator = uc.GetItemOf("+") while PlusOperator.ItemHandle <> 0 Console.WriteLine("Def: " + PlusOperator.Text() + " Type: " + PlusOperator.GetDataType().Name()) PlusOperator = PlusOperator.NextOverload() End while ' Output ' Def: Operator_: 70 +{x} Type: double ' Def: Operator_: 50 {x} + {y} Type: double ' Def: Operator_: 50 {x As Int32} + {y As Int32} As Int32 Type: Int32 ' Def: Operator_: 50 {x As String} + {y As String} As String Type: string ' Def: Operator_: 50 {x} + {y As Complex} As Complex Type: complex ' Def: Operator_: 50 {x As Complex} + {y} As Complex Type: complex ' Def: Operator_: 50 {x As Complex} + {y As Complex} As Complex Type: complex ```
``` var PlusOperator = uc.GetItemOf("+"); while (PlusOperator.ItemHandle != null) { Console.WriteLine("Def: " + PlusOperator.Text() + " Type: " + PlusOperator.GetDataType().Name()); PlusOperator = PlusOperator.NextOverload(); } // Output // Def: Operator: 70 +{x} Type: double // Def: Operator: 50 {x} + {y} Type: double // Def: Operator: 50 {x As Int32} + {y As Int32} As Int32 Type: Int32 // Def: Operator: 50 {x As String} + {y As String} As String Type: string // Def: Operator: 50 {x} + {y As Complex} As Complex Type: complex // Def: Operator: 50 {x As Complex} + {y} As Complex Type: complex // Def: Operator: 50 {x As Complex} + {y As Complex} As Complex Type: complex ```
``` //var PlusOperator = uc.GetItemOf('+'); while PlusOperator.ItemHandle <> 0 do begin WriteLn('Def: ' + PlusOperator.Text() + ' Type: ' + PlusOperator.GetDataType().Name()); PlusOperator = PlusOperator.NextOverload(); End; // Output // Def: Operator_: 70 +{x} Type: double // Def: Operator_: 50 {x} + {y} Type: double // Def: Operator_: 50 {x As Int32} + {y As Int32} As Int32 Type: Int32 // Def: Operator_: 50 {x As String} + {y As String} As String Type: string // Def: Operator_: 50 {x} + {y As Complex} As Complex Type: complex // Def: Operator_: 50 {x As Complex} + {y} As Complex Type: complex // Def: Operator_: 50 {x As Complex} + {y As Complex} As Complex Type: complex ```
``` auto PlusOperator = uc.GetItemOf("+"); while (PlusOperator.ItemHandle != NULL) { cout << "Def: " << PlusOperator.Text() << " Type: " << PlusOperator.GetDataType().Name() << endl; PlusOperator = PlusOperator.NextOverload(); } // Output // Def: Operator: 70 +{x} Type: double // Def: Operator: 50 {x} + {y} Type: double // Def: Operator: 50 {x As Int} + {y As Int} As Int Type: int // Def: Operator: 50 {x As String} + {y As String} As String Type: string // Def: Operator: 50 {x} + {y As Complex} As Complex Type: complex // Def: Operator: 50 {x As Complex} + {y} As Complex Type: complex // Def: Operator: 50 {x As Complex} + {y As Complex} As Complex Type: complex ```
``` auto PlusOperator = uc.GetItemOf("+"); while (PlusOperator.ItemHandle != 0) { Console::WriteLine("Def: " + PlusOperator.Text() + " Type: " + PlusOperator.GetDataType().Name()); PlusOperator = PlusOperator.NextOverload(); } // Output // Def: Operator: 70 +{x} Type: double // Def: Operator: 50 {x} + {y} Type: double // Def: Operator: 50 {x As Int} + {y As Int} As Int Type: int // Def: Operator: 50 {x As String} + {y As String} As String Type: string // Def: Operator: 50 {x} + {y As Complex} As Complex Type: complex // Def: Operator: 50 {x As Complex} + {y} As Complex Type: complex // Def: Operator: 50 {x As Complex} + {y As Complex} As Complex Type: complex ```
Example 2: Inspecting the parts of a syntax construct
``` uc.DefineSyntax("This {etc} ::= That") ' Note that the SkipExpansion arg is set to true for this Syntax construct Console.WriteLine(uc.GetItemOf("This", 0, true).Text()) ' Returns "ChangeMulti ~~ Syntax: This {etc} ::= That" Console.WriteLine(uc.GetItemOf("This", 0, true).ReplacementText()) ' Returns "That" ```
``` uc.DefineSyntax("This {etc} ::= That"); // Note that the SkipExpansion arg is set to true for this Syntax construct Console.WriteLine(uc.GetItemOf("This", 0, true).Text()); // Returns "ChangeMulti ~~ Syntax: This {etc} ::= That"; Console.WriteLine(uc.GetItemOf("This", 0, true).ReplacementText()); // Returns "That"; ```
``` uc.DefineSyntax('This {etc} ::= That'); // Note that the SkipExpansion arg is set to true for this Syntax construct WriteLn(uc.GetItemOf('This', 0, true).Text()); // Returns 'ChangeMulti ~~ Syntax: This {etc} ::= That'; WriteLn(uc.GetItemOf('This', 0, true).ReplacementText()); // Returns 'That'; ```
``` uc.DefineSyntax("This {etc} ::= That"); // Note that the SkipExpansion arg is set to true for this Syntax construct cout << uc.GetItemOf("This", 0, true).Text() << endl; // Returns "ChangeMulti ~~ Syntax: This {etc} ::= That"; cout << uc.GetItemOf("This", 0, true).ReplacementText() << endl; // Returns "That"; ```
``` uc.DefineSyntax("This {etc} ::= That"); // Note that the SkipExpansion arg is set to true for this Syntax construct Console::WriteLine(uc.GetItemOf("This", 0, true).Text()); // Returns "ChangeMulti ~~ Syntax: This {etc} ::= That"; Console::WriteLine(uc.GetItemOf("This", 0, true).ReplacementText()); // Returns "That"; ```
DLL import code
``` <DllImport(uCalcDLL, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="Text")> _ Private Function Text__(ByVal ItemHandle As IntPtr) As IntPtr End Function ```
``` [DllImport(uCalcDLL, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl, EntryPoint="Text")] protected static extern IntPtr Text_(IntPtr ItemHandle); ```
``` {DLLImport}function Text__(ItemHandle: System.Pointer): PAnsiChar; cdecl; external uCalcDLL name 'Text'; ```
``` typedef const char * (* __Text)(void *ItemHandle); ```
``` [DllImport(uCalcLib, CharSet=CharSet::Ansi, CallingConvention=CallingConvention::Cdecl, EntryPoint = "Text")] static STR_RETURN Text_(void * ItemHandle); ```