jsexecutor class : GetTypeName(string) method

Description

Returns the type of string that returned as the result of the JavaScript.

Syntax

instance.GetTypeName(string ret)

Arguments

ClassNameDescription
stringretReturn value from JavaScript.

Return value

ClassDescription
stringThe type of string that returned as the result of the JavaScript.

Sample code

1:

string jscode = "return 100;";

2:

jsexecutor jse;

3:

string result = jse.Execute(jscode); // Returns 100 as string.

4:

string typeName = jse.GetTypeName(result); // Returns "int".

Notes

Return values from the JavaScript are converted to strings and returned. This method returns a class name in which the string can be converted.

If it can be converted to an integer and the converted value falls within the range of int, returns "int". If it exceeds the range of int, returns "long".

If the number cannot be converted to an integer, returns "real".

If it can be converted to a boolean value, returns "bool".

If the string is enclosed in double quotes, returns "string".

If the string is "null" or unevaluable, returns "null".

Links for reference

None.

Copyright © Cooker All rights reserved.