+ <p>Use the <b>is a</b> <glossary tag="operator">operator</glossary> to <glossary tag="validate">validate</glossary> data to make sure it's the right type.</p><p/><p><b>Parameters:</b></p><p>The <i>value</i> is any source of value.</p><p/><p><b>Comments:</b></p><p>This operator is useful for checking whether the user has entered data correctly, and for checking parameters before sending them to a handler to avoid a script error caused by feeding data of one type to an operator or function that requires a different type.</p><p/><p>A <i>value</i> is a(n):</p><p> * array if it's <function tag="keys">keys function</function> is not empty.</p><p/><p> * boolean or logical if it is one of the two constants <b>true</b> or false</p><p/><p> * color if it is a valid color reference</p><p/><p> * date if it is in one of the formats produced by the <b>date</b> or <function tag="time">time</function> functions</p><p/><p> * integer if it consists of digits (with an optional leading minus sign)</p><p/><p> * number if it consists of digits, optional leading minus sign, optional decimal point, and optional "E" or "e" (scientific notation), or an optional leading minus sign and <b>infinity</b> or <b>inf</b></p><p/><p> * point if it consists of two numbers separated by a comma</p><p/><p> * rect if it consists of four numbers separated by commas</p><p> * ASCII string if it does not contain any characters greater than charToNum(127)</p><p/><p/><p>All the types other than boolean can also include leading or trailing white space characters.</p><p/><p><b>Note:</b> To ensure compatibility with SuperCard stacks, the <b>is a color</b> operator returns true for any integer, although integers are not valid colors in LiveCode. If you need to strictly verify a color then you can write a wrapper function to do so that checks that the color is not an integer.</p><p/><p><font face="tahoma"><b>Note:</b> The range of dates that LiveCode can handle is limited by the operating system's date routines. In particular, Windows systems are limited to dates after 1/1/1970. This means that the<b> is a date</b> operator will return false for dates before 1/1/1970 on Windows.</font></p><p/><p>The <b>is a</b> <glossary tag="operator">operator</glossary> is the logical inverse of the <operator tag="is not a">is not a</operator> <glossary tag="operator">operator</glossary>. When one is true, the other is false.</p><p/><p><b>Changes:</b></p><p>The <i>is an array</i> form was added in version 2.9</p>
0 commit comments