VS:ValidNumStr: Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
No edit summary |
||
Line 68: | Line 68: | ||
==== Python ==== | ==== Python ==== | ||
<code lang="py"> | <code lang="py"> | ||
str = '5m + 5cm' | |||
ok, num = vs.ValidNumStr( str ) | |||
vs.AlrtDialog( num ) | |||
</code> | </code> | ||
</sample> | </sample> |
Latest revision as of 14:28, 7 July 2015
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Function ValidNumStr returns TRUE if the specified string can be converted into a numeric value. If TRUE, the numeric value is returned.
FUNCTION ValidNumStr(
str :STRING;
VAR value :REAL) : BOOLEAN;
def vs.ValidNumStr(str): return (BOOLEAN, value)
Parameters
str STRING String value to be checked for numeric validity. value REAL Numeric value converted from input string.
Return Value
Returns TRUE if specified string can be converted into a numeric value.
Remarks
(Joel Sciamma, 2007.01.13):
- Returns TRUE if the specified string can be converted into a numeric value and places the value in the REAL parameter.
- Returns FALSE if the specified string can not be converted into a numeric value and places zero in the REAL parameter.
Example
VectorScript
CASE Item OF {// OK Button //} 1:BEGIN IF ValidNumStr(GetField(4),value) THEN BEGIN Done:=TRUE; replaceValue:= GetField(6); IF ItemSel(9) THEN textMode:=2; IF ItemSel(10) THEN textMode:=4; IF ItemSel(11) THEN textMode:=8; IF ItemSel(12) THEN layerMode:=16; IF ItemSel(13) THEN layerMode:=32; IF ItemSel(14) THEN caseMode:=1; END ELSE SysBeep; END;
Python
str = '5m + 5cm' ok, num = vs.ValidNumStr( str ) vs.AlrtDialog( num )
Version
Availability: from All Versions