IIF Function:
IIF Function from Visual Basic.
Description:
IIF Function will replace the IIf function from Visual Basic that is missing from the intrinsic functions of ASP.
Syntax:
variant = IIf(expression, truecondition, falsecondition)
Details:
Arguments: expression - Boolean Expression truecondition - Result if expression is True falsecondition - Result if expression is False
Returns: truecondition - Result If expression is True falsecondition - Result if expression is False
Example:
<%
Dim a a = IIf(len(string) > 0 and isnumeric(string), true, false) '--- returns a equal to true if string is numeric and has a length greater than 1 '--- otherwise, it will always be false.
a = IIf(isnumeric(string), "Numeric", "Not numeric") '--- returns 'Numeric' if string is numeric '--- otherwise, it will return 'Not numeric'.
%>
ASP Source Code:
<%
Public Function IIf(ByVal expression, ByVal truecondition, ByVal falsecondition) if cbool(expression) then IIf = truecondition else IIf = falsecondition End Function
%>
|