ad_page_contract_filter_proc_integer (public)
ad_page_contract_filter_proc_integer name value_varname
Defined in packages/acs-tcl/tcl/tcl-documentation-procs.tcl
Checks whether the value is a valid integer, and removes any leading zeros so as not to confuse Tcl into thinking it's octal. Allows negative numbers.
- Parameters:
- name
value_varname
- Author:
- Lars Pind <lars@pinds.com>
- Created:
- 25 July 2000
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- ad_page_contract_filters, page_contracts
Source code: upvar $value_varname value # # We can't really use "string is integer -strict", since it allows # numbers, which are invalid for e.g. SQL... e.g. "0x40". # ## First simple a quick check avoiding the slow regexp #if {[string is integer -strict $value]} { # return 1 #} if { [regexp {^(-)?(\d+)$} $value _ sign rest] } { # Trim the value for any leading zeros set value $sign[util::trim_leading_zeros $rest] # the string might be still too large, so check again... if {[string is integer -strict $value]} { return 1 } } ad_complain [_ acs-tcl.lt_name_is_not_an_intege] return 0XQL Not present: Generic, PostgreSQL, Oracle