Getting the variable type and checking in ASPIn ASP we can check what type of ( data ) variable it is before using. We can use the function VarType to display a value for associated with each type of variable. This value is a number so linking this number to type of data is to be done. There is another function TypeName which displays the Data type directly without any associated value.We can check for a specific type by using the function isArray, isDate etc functions. These are useful while developing code for further processing while working with variables. Let us start with some syntax of TypeName function.
In the above code we have declared v1 as a variable and assigned a string data to it. So now the variable v1 became string variable. So we will get an output like this by using the above code.
We can change the value of v1 to different values and see the type of variable TypeName function returns.
We can create a double variable and check with isArray function to get true or false. Here is the code for this.
The output of the above code is shown here.
This article is written by plus2net.com team.
Be the first to post comment on this article : |