ToString (ByStr)Method

Applies to:Fast Math Parser
Class:uCalc.DataType
Retuns a formatted string of the given data type representing the value that was passed as text
Syntax
ToString(Value)
Parameters
Value
String
String representing data of any type that is to be represented as data of the given type
Returns
Type: String
Retuns a formatted string of the given data type representing the value that was passed as text
Remarks
If you pass a string, it will be converted to the given data type, and return using the formatting for that data type.
Example 1: Displaying formatted data from string input

Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Integer_8u).ToString("-1")) ' Returns 255
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Integer_16u).ToString("-1")) ' Returns 65535
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Boolean).ToString("-1")) ' Returns "false"
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Complex).ToString("-1")) ' Returns "0+1i"
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_String).ToString("-1")) ' Returns "-1"

          

Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Integer_8u).ToString("-1")); // Returns 255;
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Integer_16u).ToString("-1")); // Returns 65535;
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Boolean).ToString("-1")); // Returns "false";
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Complex).ToString("-1")); // Returns "0+1i";
Console.WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_String).ToString("-1")); // Returns "-1";

          

      WriteLn(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Integer_8u).ToString('-1')); // Returns 255;
      WriteLn(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Integer_16u).ToString('-1')); // Returns 65535;
      WriteLn(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Boolean).ToString('-1')); // Returns 'false';
      WriteLn(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_Complex).ToString('-1')); // Returns '0+1i';
      WriteLn(uc.DataTypeOfIndex(BuiltInTypesEnum.Type_String).ToString('-1')); // Returns '-1';

          

cout << uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Integer_8u).ToString("-1") << endl; // Returns 255;
cout << uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Integer_16u).ToString("-1") << endl; // Returns 65535;
cout << uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Boolean).ToString("-1") << endl; // Returns "false";
cout << uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Complex).ToString("-1") << endl; // Returns "0+1i";
cout << uc.DataTypeOfIndex(BuiltInTypesEnum::Type_String).ToString("-1") << endl; // Returns "-1";

          

Console::WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Integer_8u).ToString("-1")); // Returns 255;
Console::WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Integer_16u).ToString("-1")); // Returns 65535;
Console::WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Boolean).ToString("-1")); // Returns "false";
Console::WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum::Type_Complex).ToString("-1")); // Returns "0+1i";
Console::WriteLine(uc.DataTypeOfIndex(BuiltInTypesEnum::Type_String).ToString("-1")); // Returns "-1";

          
DLL import code
<DllImport(uCalcDLL, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="ToString_Overload_DataType_ByStr")> _

Private Function ToString_Overload_DataType_ByStr__(ByVal DataTypeHandle As IntPtr,ByVal Value As String) As IntPtr
End Function
            
[DllImport(uCalcDLL, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl, EntryPoint="ToString_Overload_DataType_ByStr")]

protected static extern  IntPtr ToString_Overload_DataType_ByStr_(IntPtr DataTypeHandle, string Value);
            
{DLLImport}function ToString_Overload_DataType_ByStr__(DataTypeHandle: System.Pointer;Value: AnsiString):  PAnsiChar; cdecl; external uCalcDLL name 'ToString_Overload_DataType_ByStr';

            
typedef const char * (* __ToString_Overload_DataType_ByStr)(void *DataTypeHandle, CONSTCHAR Value ); 

            
[DllImport(uCalcLib, CharSet=CharSet::Ansi, CallingConvention=CallingConvention::Cdecl, EntryPoint = "ToString_Overload_DataType_ByStr")]

static STR_RETURN ToString_Overload_DataType_ByStr_(void *  DataTypeHandle, MARSHALSTR Value);
            
See also
Prev | Next