Carapace

Integer Class

Integer Creation

The create function can be used to create an integer - though this is almost never used! To create the integer 33

    (create Integer 33)
will work, but so will:
    33

Integer Properties

None

Integer Methods

method name description
char treating the integer as an ascii character code, return a string containing just this character
string create a string holding the digits of this integer
binary create a binary representing the 4 bytes of this integer
format format the integer according to the supplied format specification
copy copy this integer
integer copy this integer
real convert this to a Real
+ return the sum of this integer and the supplied one
- return the result of this integer minus the supplied one
* return the result of this integer multiplied by the supplied one
/ return the result of this integer divided by the supplied one
== test whether this integer is equal to the supplied one
!= test whether this integer is not equal to the supplied one
< test whether this integer is less than the supplied one
> test whether this integer is greater than the supplied one
<= test whether this integer is less than or equal to the supplied one
>= test whether this integer is greater than or equal to the supplied one
++ increment this integer
-- decrement this integer
& bitwise AND operator
| bitwise OR operator
bit get or set the bit
isBitSet test if the bit is set
<< bitwise shift the integer left
>> bitwise shift the integer right


char

Treating the integer as an ascii character code, return a string containing just this character.

Arguments: none

Return type: String


string

Create a string holding the digits of this integer.

Arguments: none

Return type: String


binary

Create a binary holding the 4 bytes of this integer.

Arguments: none

Return type: Binary


format

Format the integer according to the supplied format specification. The format spec is the standard C printf spec. The following are valid examples:


    "%06d"
    "%*d"
If the format spec requires additional integer arguments, then these must be supplied

Arguments:

formatSpecString
...one or two Integers to match the formatSpec

Return type: an appropriately formatted String


copy

Copy this integer.

Arguments: none

Return type: Integer


integer

Copy this integer.

Arguments: none

Return type: Integer


real

Convert this integer to a Real.

Arguments: none

Return type: Real


+

Return the sum of this integer and the supplied one.

Arguments:

xInteger

Return type: Integer


-

Return the result of this integer minus the supplied one.

Arguments:

xInteger

Return type: Integer


*

Return the result of this integer multiplied by the supplied one.

Arguments:

xInteger

Return type: Integer


/

Return the result of this integer divided by the supplied one.

Arguments:

xInteger

Return type: Integer


==

Test whether this integer is equal to the supplied one.

Arguments:

xInteger

Return type: Object


!=

Test whether this integer is not equal to the supplied one.

Arguments:

xInteger

Return type: Object


<

Test whether this integer is less than the supplied one.

Arguments:

xInteger

Return type: Object


>

Test whether this integer is greater than the supplied one.

Arguments:

xInteger

Return type: Object


<=

Test whether this integer is less than or equals the supplied one.

Arguments:

xInteger

Return type: Object


>=

Test whether this integer is greater than or equals the supplied one.

Arguments:

xInteger

Return type: Object


++

Increment the value of this integer.

Arguments: none

Return type: List - the empty list () is returned.


--

Decrement the value of this integer.

Arguments: none

Return type: List - the empty list () is returned.


&

Bitwise AND operator. All the supplied Integer are combined using the bitwise AND.

Arguments:

xInteger
...further Integer arguments

Return type: Integer


|

Bitwise OR operator. All the supplied Integer are combined using the bitwise OR.

Arguments:

xInteger
...further Integer arguments

Return type: Integer


bit

Get or set the bit. With a single argument, the bit is returned. With two arguments, the bit is set.

Arguments:

bitNoInteger
(optional)bitValueInteger

Return type: Integer


<<

Bitwise shift the integer left.

Arguments:

nPlacesInteger

Return type: Integer


>>

Bitwise shift the integer right.

Arguments:

nPlacesInteger

Return type: Integer


isBitSet

Test if the bit is set.

Arguments:

bitPositionInteger

Return type: Object


Contents Index Current topic: objects Related links: builtin objects