Lasso Soft Inc. > Home

[ integer ]

Method

The [integer] method returns an integer, the value of which depends on the parameter(s) passed to the method. It has the following variants:

  • integer()
    • Returns zero
  • integer(s::string, base::integer)
    • Converts the string parameter into an integer using the base indicator. For example, octal would be 8 while hexadecimal would be 16. One would not include any prefixes on the string value. For example a '0x' or a leading zero for octal.
  • integer(d::decimal)
    • Decimal is rounded to the nearest integer.
  • integer(i::integer)
    • Returns the parameter unchanged.
  • integer(s::string)
    • Converts the string into an integer, respecting any leading - or + operators.
  • integer(b::boolean)
    • Returns zero or one depending on the parameter value.
  • integer(b::bytes)
    • Converts the bytes into a string using UTF-8 and then performs as the integer(::string) variant does.
  • Syntax
  • Methods
  • Traits
Integer(Value)

local(result = integer(Value))
Has methods:
Examples
  • Beginner

To cast an action parameter to type integer:

Values retrieved from an HTML form or URL using [Action_Param] are always of data type string. It is necessary to cast these values to integer if they will be used in a mathematical expression using symbols.

The following example adds the values for two [Action_Param] methods using the math symbol +.

Code

integer(action_param('Price')) + integer(action_param('Shipping'))

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft