Note that there are some explanatory texts on larger screens.

plurals
  1. POFoxPro functions which determine if a variable is a character string or a numeric string
    primarykey
    data
    text
    <p>I'm looking for a Visual FoxPro function which is similar to the PHP function <a href="http://php.net/manual/en/function.is-numeric.php" rel="nofollow noreferrer">is_numeric()</a>.<br> I have found <a href="https://stackoverflow.com/questions/7563907/function-to-know-that-a-variable-is-string-or-number-on-foxpro">this</a>, but I could not use <code>VARTYPE</code> or <code>TYPE</code> because the variable is always a character string which contains digits only.</p> <p>I found <code>ISDIGIT()</code> function, but the manual says that it only checks the first character.</p> <blockquote> <p>Determines whether the leftmost character of the specified character expression is a digit (0 through 9).</p> <pre><code> ISDIGIT(cExpression) </code></pre> <p><strong>Parameters</strong><br> <em>cExpression</em> </p> <p>Specifies the character expression that ISDIGIT( ) tests. Any characters after the first character in cExpression are ignored.</p> </blockquote> <p>I would create my own function using the regular expression object <code>VBScript.RegExp</code></p> <pre><code>FUNCTION isNumeric( tcValue ) LOCAL oRE oRE = CreateObject("VBScript.RegExp") oRE.Pattern = '^[0-9]+$' RETURN oRE.test( tcValue ) ENDFUNC ? isNumeric( '123' ) </code></pre> <p>But, is there any function provided by FoxPro for this purpose?<br> Am I just overlooking?</p> <p>Also same for <code>ISALHPA()</code> which determines whether the leftmost character in a character expression is alphabetic. I want to check if the variable contain only alphabets.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload