ad_page_contract_filter_proc_negative_float (public)

 ad_page_contract_filter_proc_negative_float name value_varname

Defined in packages/acs-tcl/tcl/tcl-documentation-procs.tcl

Same as float but allows negative numbers too GN: this is deprecated, since "float" allows as well negative numbers

Parameters:
name
value_varname
Author:
Brian Fenton
Created:
1 December 2004

Partial Call Graph (max 5 caller/called nodes):
%3 test_ad_page_contract_filters ad_page_contract_filters (test acs-tcl) ad_page_contract_filter_proc_negative_float ad_page_contract_filter_proc_negative_float test_ad_page_contract_filters->ad_page_contract_filter_proc_negative_float _ _ (public) ad_page_contract_filter_proc_negative_float->_ ad_complain ad_complain (public) ad_page_contract_filter_proc_negative_float->ad_complain util::trim_leading_zeros util::trim_leading_zeros (public) ad_page_contract_filter_proc_negative_float->util::trim_leading_zeros

Testcases:
ad_page_contract_filters
Source code:
upvar $value_varname value

    # Check if the first character is a "+" or "-"
    set signum ""
    if {[regexp {^([\+\-])(.*)} $value match signum rest]} {
        set value $rest
    }

    # remove the first decimal point, the theory being that
    # at this point a valid float will pass an integer test
    regsub {\.} $value "" value_to_be_tested

    if { ![regexp {^[0-9]+$} $value_to_be_tested] } {
        ad_complain [_ acs-tcl.lt_Value_is_not_an_decim]
        return 0
    }

    set value [util::trim_leading_zeros $value]

    # finally add the signum character again
    set value "$signum$value"

    return 1
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: