+
Point of view
All features
expanded class CHARACTER
Summary
Note: An Eiffel CHARACTER is mapped as a C unsigned char or as a Java Byte.
Direct parents
Insert list: COMPARABLE, HASHABLE, PLATFORM
Overview
Features
{ANY}
{}
Conversions:
{ANY}
Object Printing:
{ANY}
Hashing:
{ANY}
Miscellaneous:
{ANY}
{}
{ANY}
  • is_equal (other: CHARACTER): BOOLEAN
    Is other attached to an object considered equal to current object?
{ANY}
  • in_range (lower: CHARACTER, upper: CHARACTER): BOOLEAN
    Return True if Current is in range [lower..upper]
    See also min, max, compare.
  • compare (other: CHARACTER): INTEGER_32
    If current object equal to other, 0 if smaller, -1; if greater, 1.
  • three_way_comparison (other: CHARACTER): INTEGER_32
    If current object equal to other, 0 if smaller, -1; if greater, 1.
  • min (other: CHARACTER): CHARACTER
    Minimum of Current and other.
  • max (other: CHARACTER): CHARACTER
    Maximum of Current and other.
  • bounded_by (a_min: CHARACTER, a_max: CHARACTER): CHARACTER
    A value that is equal to Current if it is between the limits set by a_min and a_max.
Maximum:
{}
Minimum:
{}
Bits:
{}
code: INTEGER_16
{ANY}
ASCII code of Current.
(No Sign-extended conversion.)
See also to_integer_8.
ensure
to_integer_8: INTEGER_8
{ANY}
Sign-extended conversion.
See also code.
to_integer: INTEGER_8
effective function
{ANY}
This feature is obsolete: Use `to_integer_8' instead (March 2006).
infix "<" (other: CHARACTER): BOOLEAN
effective function
{ANY}
Comparison using code.
require
  • other_exists: other /= Void
ensure
  • Result = code < other.code
  • asymmetric: Result implies not other < Current
infix "<=" (other: CHARACTER): BOOLEAN
effective function
{ANY}
Comparison using code.
require
  • other_exists: other /= Void
ensure
  • definition: Result = Current < other or is_equal(other)
infix ">" (other: CHARACTER): BOOLEAN
effective function
{ANY}
Comparison using code.
require
  • other_exists: other /= Void
ensure
  • definition: Result = other < Current
infix ">=" (other: CHARACTER): BOOLEAN
effective function
{ANY}
Comparison using code.
require
  • other_exists: other /= Void
ensure
  • definition: Result = other <= Current
value: INTEGER_8
effective function
{ANY}
Gives the value of a decimal digit.
require ensure
  • Result.in_range(0, 9)
decimal_value: INTEGER_8
effective function
{ANY}
Gives the value of a decimal digit.
require ensure
  • Result.in_range(0, 9)
binary_value: INTEGER_8
effective function
{ANY}
Gives the value of a binary digit.
require ensure
  • Result.in_range(0, 1)
octal_value: INTEGER_8
effective function
{ANY}
Gives the value of an octal digit.
require ensure
  • Result.in_range(0, 7)
hexadecimal_value: INTEGER_8
effective function
{ANY}
Gives the value of an hexadecimal digit.
require ensure
  • Result.in_range(0, 15)
same_as (other: CHARACTER): BOOLEAN
effective function
{ANY}
Case insensitive comparison.
No difference between upper/lower case letters.
ensure
to_upper: CHARACTER
effective function
{ANY}
Conversion to the corresponding upper case.
to_lower: CHARACTER
effective function
{ANY}
Conversion to the corresponding lower case.
is_letter: BOOLEAN
effective function
{ANY}
Is it a letter ('a' .. 'z' or 'A' .. 'Z') ?
ensure
is_digit: BOOLEAN
effective function
{ANY}
Belongs to '0'..'
9'.
See also value, decimal_value
ensure
is_decimal_digit: BOOLEAN
effective function
{ANY}
Belongs to '0'..'
9'.
See also value, decimal_value
ensure
is_binary_digit: BOOLEAN
effective function
{ANY}
Belongs to '0'..'
1'.
ensure
is_octal_digit: BOOLEAN
effective function
{ANY}
Belongs to '0'..'
7'.
ensure
is_hexadecimal_digit: BOOLEAN
effective function
{ANY}
Is it one character of "0123456789abcdefABCDEF" ?
ensure
  • Result = "0123456789abcdefABCDEF".has(Current)
is_lower: BOOLEAN
effective function
{ANY}
Is it some lowercase letter ('a'..'z')?
is_upper: BOOLEAN
effective function
{ANY}
Is it some uppercase letter ('A'..'Z')?
is_separator: BOOLEAN
effective function
{ANY}
True when character is a separator.
is_letter_or_digit: BOOLEAN
effective function
{ANY}
Is it a letter (see is_letter) or a digit (see is_digit) ?
ensure
is_ascii: BOOLEAN
effective function
{ANY}
Is character a 8-bit ASCII character?
is_bit: BOOLEAN
effective function
{ANY}
True for 0 and 1.
next: CHARACTER
effective function
{ANY}
Give the next character (the following code)
previous: CHARACTER
effective function
{ANY}
Give the previous character (the code before)
infix "|..|" (other: CHARACTER): INTEGER_RANGE[CHARACTER]
effective function
{ANY}
require
  • Current <= other
integer_range_itemize: FUNCTION[TUPLE 1[INTEGER_32], CHARACTER]
once function
{}
integer_range_indexize: FUNCTION[TUPLE 1[CHARACTER], INTEGER_32]
once function
{}
to_hexadecimal: STRING
effective function
{ANY}
Create a new STRING giving the code in hexadecimal.
For example :
   (255).to_character.to_hexadecimal gives "FF".
Note: see to_hexadecimal_in to save memory.
ensure
  • Result.count = 2
to_hexadecimal_in (str: STRING)
effective procedure
{ANY}
Append the equivalent of to_hexadecimal at the end of str.
Thus you can save memory because no other STRING is allocated for the job.
ensure
  • str.count = 2 + old str.count
to_string: STRING
effective function
{ANY}
ensure
  • Result.count = 1
  • Result.first = Current
out_in_tagged_out_memory
effective procedure
{ANY}
Append terse printable representation of current object in tagged_out_memory.
require
    • locked: tagged_out_locked
    • locked: tagged_out_locked
ensure
  • still_locked: tagged_out_locked
  • not_cleared: tagged_out_memory.count >= old tagged_out_memory.count
  • append_only: old tagged_out_memory.twin.is_equal(tagged_out_memory.substring(1, old tagged_out_memory.count))
fill_tagged_out_memory
effective procedure
{ANY}
Append a viewable information in tagged_out_memory in order to affect the behavior of out, tagged_out, etc.
require
    • locked: tagged_out_locked
    • locked: tagged_out_locked
ensure
  • still_locked: tagged_out_locked
hash_code: INTEGER_32
effective function
{ANY}
The hash-code value of Current.
ensure
  • good_hash_value: Result >= 0
is_alpha: BOOLEAN
effective function
{ANY}
See is_letter (yes this is just a call to is_letter).
Isn't is_letter better English ;-)
ensure
_inline_agent49 (i: INTEGER_32): CHARACTER
frozen
effective function
{}
_inline_agent50 (i: CHARACTER): INTEGER_32
frozen
effective function
{}
is_equal (other: CHARACTER): BOOLEAN
deferred function
{ANY}
Is other attached to an object considered equal to current object?
require
  • other /= Void
ensure
  • Result implies hash_code = other.hash_code
  • commutative: generating_type = other.generating_type implies Result = other.is_equal(Current)
in_range (lower: CHARACTER, upper: CHARACTER): BOOLEAN
effective function
{ANY}
Return True if Current is in range [lower..upper]
See also min, max, compare.
ensure
  • Result = Current >= lower and Current <= upper
compare (other: CHARACTER): INTEGER_32
effective function
{ANY}
If current object equal to other, 0 if smaller, -1; if greater, 1.
See also min, max, in_range.
require
  • other_exists: other /= Void
ensure
  • equal_zero: Result = 0 = is_equal(other)
  • smaller_negative: Result = -1 = Current < other
  • greater_positive: Result = 1 = Current > other
three_way_comparison (other: CHARACTER): INTEGER_32
effective function
{ANY}
If current object equal to other, 0 if smaller, -1; if greater, 1.
See also min, max, in_range.
require
  • other_exists: other /= Void
ensure
  • equal_zero: Result = 0 = is_equal(other)
  • smaller_negative: Result = -1 = Current < other
  • greater_positive: Result = 1 = Current > other
min (other: CHARACTER): CHARACTER
effective function
{ANY}
Minimum of Current and other.
See also max, in_range.
require
  • other /= Void
ensure
  • Result <= Current and then Result <= other
  • compare(Result) = 0 or else other.compare(Result) = 0
max (other: CHARACTER): CHARACTER
effective function
{ANY}
Maximum of Current and other.
See also min, in_range.
require
  • other /= Void
ensure
  • Result >= Current and then Result >= other
  • compare(Result) = 0 or else other.compare(Result) = 0
bounded_by (a_min: CHARACTER, a_max: CHARACTER): CHARACTER
effective function
{ANY}
A value that is equal to Current if it is between the limits set by a_min and a_max.
Otherwise it's a_min if Current is smaller or a_max if Current is greater It's a shortcut for Current.min(a_max).max(a_min) also known as "clamp" in the widespread C library Glib
ensure
  • correctness: Result.in_range(a_min, a_max)
Maximum_character_code: INTEGER_16
{}
Largest supported code for CHARACTER values.
ensure
  • meaningful: Result >= 127
Maximum_integer_8: INTEGER_8
is 127
constant attribute
{}
Largest supported value of type INTEGER_8.
Maximum_integer_16: INTEGER_16
is 32767
constant attribute
{}
Largest supported value of type INTEGER_16.
Maximum_integer: INTEGER_32
is 2147483647
constant attribute
{}
Largest supported value of type INTEGER/INTEGER_32.
Maximum_integer_32: INTEGER_32
is 2147483647
constant attribute
{}
Largest supported value of type INTEGER/INTEGER_32.
Maximum_integer_64: INTEGER_64
is 9223372036854775807
constant attribute
{}
Largest supported value of type INTEGER_64.
Maximum_real_32: REAL_32
is {REAL_32 3.4028234663852885981170418348451692544e+38}
constant attribute
{}
Largest non-special (no NaNs nor infinity) supported value of type REAL_32.
Maximum_real: REAL_64
{}
Largest non-special (no NaNs nor infinity) supported value of type REAL.
Just to give an idea of this value: 1.79769313486231570....e+308
Maximum_real_64: REAL_64
{}
Largest non-special (no NaNs nor infinity) supported value of type REAL.
Just to give an idea of this value: 1.79769313486231570....e+308
Maximum_real_80: REAL_EXTENDED
{}
Largest supported value of type REAL_80.
ensure
Minimum_character_code: INTEGER_16
{}
Smallest supported code for CHARACTER values.
ensure
  • meaningful: Result <= 0
Minimum_integer_8: INTEGER_8
is -128
constant attribute
{}
Smallest supported value of type INTEGER_8.
Minimum_integer_16: INTEGER_16
is -32768
constant attribute
{}
Smallest supported value of type INTEGER_16.
Minimum_integer: INTEGER_32
is -2147483648
constant attribute
{}
Smallest supported value of type INTEGER/INTEGER_32.
Minimum_integer_32: INTEGER_32
is -2147483648
constant attribute
{}
Smallest supported value of type INTEGER/INTEGER_32.
Minimum_integer_64: INTEGER_64
is -9223372036854775808
constant attribute
{}
Smallest supported value of type INTEGER_64.
Minimum_real_32: REAL_32
is {REAL_32 -3.40282346638528859811704183484516925440e+38}
constant attribute
{}
Smallest non-special (no NaNs nor infinity) supported value of type REAL_32.
Minimum_real: REAL_64
{}
Smallest non-special (no NaNs nor infinity) supported value of type REAL.
Just to give an idea of this value: -1.79769313486231570....e+308
Minimum_real_64: REAL_64
{}
Smallest non-special (no NaNs nor infinity) supported value of type REAL.
Just to give an idea of this value: -1.79769313486231570....e+308
Minimum_real_80: REAL_64
{}
Smallest supported value of type REAL_80.
ensure
  • meaningful: Result <= 0.0
Boolean_bits: INTEGER_32
{}
Number of bits in a value of type BOOLEAN.
ensure
  • meaningful: Result >= 1
Character_bits: INTEGER_32
{}
Number of bits in a value of type CHARACTER.
ensure
Integer_bits: INTEGER_32
{}
Number of bits in a value of type INTEGER.
ensure
  • integer_definition: Result = 32
Real_bits: INTEGER_32
is 64
constant attribute
{}
Number of bits in a value of type REAL.
Pointer_bits: INTEGER_32
{}
Number of bits in a value of type POINTER.