deferred class NATIVELY_STORED_STRING
Summary
Class invariant
Overview
Exported features
Concatenation
Access
  • lower: INTEGER_32
    Minimum index; actually, this is always 1 (this feature here to mimic the one of the COLLECTION hierarchy).
  • upper: INTEGER_32
    Maximum index; actually the same value as count (this feature is here to mimic the one of the COLLECTION hierarchy).
  • copy (other: NATIVELY_STORED_STRING)
    Update current object using fields of object attached to other, so as to yield equal objects.
Testing:
Testing and Conversion:
Concatenation
Case conversion
Printing:
String replacing
Other features:
Splitting a STRING:
Other features:
Interfacing with C string:
  • to_external: POINTER
    The address of a memory region containing the text of Current, useful to interact with the C language.
Other features here for ELKS compatibility:
  • in_range (lower: NATIVELY_STORED_STRING, upper: NATIVELY_STORED_STRING): BOOLEAN
    Return True if Current is in range [lower..upper]
    See also min, max, compare.
  • min (other: NATIVELY_STORED_STRING): NATIVELY_STORED_STRING
    Minimum of Current and other.
  • max (other: NATIVELY_STORED_STRING): NATIVELY_STORED_STRING
    Maximum of Current and other.
  • bounded_by (a_min: NATIVELY_STORED_STRING, a_max: NATIVELY_STORED_STRING): NATIVELY_STORED_STRING
    A value that is equal to Current if it is between the limits set by a_min and a_max.
Other features:
Agent-based features:
Agent-based features:
Indexing:
  • recycle
    Do whatever needs to be done to free resources or recycle other objects when recycling this one
count: INTEGER_32
writable attribute
Number of available items in the hoard.
capacity: INTEGER_32
writable attribute
Capacity of the storage area.
item (i: INTEGER_32): CHARACTER
effective function
Character at position i.
is_equal (other: ABSTRACT_STRING): BOOLEAN
effective function
It other does not conform to NATIVELY_STORED_STRING this query is an O(count.max(other.count)) operation, requiring iterating over both strings.
same_as (other: ABSTRACT_STRING): BOOLEAN
effective function
Case insensitive is_equal.
index_of (c: CHARACTER, start_index: INTEGER_32): INTEGER_32
effective function
Using is_equal for comparison, gives the index of the first occurrence of element at or after start_index.
fast_index_of (c: CHARACTER, start_index: INTEGER_32): INTEGER_32
effective function
Using basic = for comparison, gives the index of the first occurrence of element at or after start_index.
reverse_index_of (c: CHARACTER, start_index: INTEGER_32): INTEGER_32
effective function
Index of first occurrence of c at or before start_index, The index will be invalid, smaller than lower when no occurrence is found; The search is done in reverse direction, which means from the start_index down to the first character.
fast_reverse_index_of (c: CHARACTER, start_index: INTEGER_32): INTEGER_32
effective function
Index of first occurrence of c at or before start_index, The index will be invalid, smaller than lower when no occurrence is found; The search is done in reverse direction, which means from the start_index down to the first character.
has (c: CHARACTER): BOOLEAN
effective function
Look for x using is_equal for comparison.
fast_has (c: CHARACTER): BOOLEAN
effective function
Look for x using basic = for comparison.
occurrences (c: CHARACTER): INTEGER_32
effective function
Number of times character c appears in the string.
infix "&" (another: ABSTRACT_STRING): ABSTRACT_STRING
effective function
Current and another concatenating into a new object.
first: CHARACTER
effective function
Access to the very first character.
last: CHARACTER
effective function
Access to the very last character.
fill_tagged_out_memory
effective procedure
Append a viewable information in tagged_out_memory in order to affect the behavior of out, tagged_out, etc.
print_on (file: OUTPUT_STREAM)
effective procedure
Default printing of current object on a file.
lower: INTEGER_32
is 1
constant attribute
Minimum index; actually, this is always 1 (this feature here to mimic the one of the COLLECTION hierarchy).
upper: INTEGER_32
effective function
Maximum index; actually the same value as count (this feature is here to mimic the one of the COLLECTION hierarchy).
copy (other: NATIVELY_STORED_STRING)
deferred procedure
Update current object using fields of object attached to other, so as to yield equal objects.
is_empty: BOOLEAN
effective function
Has string length 0?
infix "@" (i: INTEGER_32): CHARACTER
frozen
effective function
The infix notation which is actually just a synonym for item.
infix "^" (a_range: INTEGER_RANGE[INTEGER_32]): ABSTRACT_STRING
effective function
Substring of items in a_range .
infix "<" (other: ABSTRACT_STRING): BOOLEAN
effective function
Is Current less than other?
infix "<=" (other: ABSTRACT_STRING): BOOLEAN
effective function
Is Current less than or equal other?
infix ">" (other: ABSTRACT_STRING): BOOLEAN
effective function
Is Current strictly greater than other?
infix ">=" (other: ABSTRACT_STRING): BOOLEAN
effective function
Is Current greater than or equal than other?
compare (other: ABSTRACT_STRING): INTEGER_32
effective function
If current object equal to other, 0 if smaller, -1; if greater, 1.
three_way_comparison (other: ABSTRACT_STRING): INTEGER_32
effective function
If current object equal to other, 0 if smaller, -1; if greater, 1.
item_code (i: INTEGER_32): INTEGER_32
effective function
Code of character at position i.
first_index_of (c: CHARACTER): INTEGER_32
effective function
Index of first occurrence of c, upper` + 1 if none. See also `last_index_of, index_of, reverse_index_of.
fast_first_index_of (c: CHARACTER): INTEGER_32
effective function
Index of first occurrence of c, upper` + 1 if none. See also `last_index_of, index_of, reverse_index_of.
last_index_of (c: CHARACTER): INTEGER_32
effective function
Index of last occurrence of c, lower` - 1 if none. See also `first_index_of, reverse_index_of, index_of.
fast_last_index_of (c: CHARACTER): INTEGER_32
effective function
Index of last occurrence of c, lower` - 1 if none. See also `first_index_of, reverse_index_of, index_of.
has_substring (other: ABSTRACT_STRING): BOOLEAN
effective function
True if Current contains other.
has_suffix (s: ABSTRACT_STRING): BOOLEAN
effective function
True if suffix of Current is s.
has_prefix (p: ABSTRACT_STRING): BOOLEAN
effective function
True if prefix of Current is p.
is_ascii: BOOLEAN
effective function
Is Current only made of (7 bit) ASCII characters?
is_boolean: BOOLEAN
effective function
Does Current represent a BOOLEAN?
to_boolean: BOOLEAN
effective function
Boolean value "True" yields True, "False" yields False (what a surprise).
is_integer: BOOLEAN
effective function
Does 'Current' represent an INTEGER?
to_integer: INTEGER_32
effective function
Current must look like an INTEGER.
is_integer_64: BOOLEAN
effective function
Does 'Current' represent an INTEGER_64?
to_integer_64: INTEGER_64
effective function
Current must look like an INTEGER_64.
is_real: BOOLEAN
effective function
Can contents be read as a REAL ? Fails for numbers where the base or "10 ^ exponent" are not in the range Minimum_real ...
to_real: REAL_64
effective function
Conversion to the corresponding REAL value.
is_number: BOOLEAN
effective function
Can contents be read as a NUMBER?
to_number: NUMBER
effective function
Current must looks like an INTEGER.
is_bit: BOOLEAN
effective function
True when the contents is a sequence of bits (i.e., mixed characters 0 and characters 1).
binary_to_integer: INTEGER_32
effective function
Assume there is enough space in the INTEGER to store the corresponding decimal value.
infix "+" (other: ABSTRACT_STRING): STRING
effective function
Create a new STRING which is the concatenation of Current and other.
infix "|" (other: ABSTRACT_STRING): ROPE
effective function
Current and other concatenated into a new ROPE, an ABSTRACT_STRING that can be efficiently concatenated.
arg (an_index: INTEGER_32, a_value: ABSTRACT_STRING): ABSTRACT_STRING
effective function
A copy of Current with the placeholder "#(an_index)" is replaced (if present) with the content of a_value.
infix "#" (a_value: ABSTRACT_STRING): ABSTRACT_STRING
effective function
A copy of Current with a placeholder "#(n)" is replaced with the content of a_value.
as_lower: STRING
effective function
New object with all letters in lower case.
as_upper: STRING
effective function
New object with all letters in upper case.
out_in_tagged_out_memory
effective procedure
Append terse printable representation of current object in tagged_out_memory.
replacing (an_old: ABSTRACT_STRING, a_new: ABSTRACT_STRING): STRING
effective function
Current with all occurrences of an_old string replaced with a_new.
replacing_in (an_old: ABSTRACT_STRING, a_new: ABSTRACT_STRING, buffer: STRING)
effective procedure
Current with all occurrences of an_old string replaced with a_new in buffer.
substring (start_index: INTEGER_32, end_index: INTEGER_32): NATIVELY_STORED_STRING
deferred function
New string consisting of items [start_index.. end_index].
substring_index (other: ABSTRACT_STRING, start_index: INTEGER_32): INTEGER_32
effective function
Position of first occurrence of other at or after start_index.
first_substring_index (other: ABSTRACT_STRING): INTEGER_32
effective function
Position of first occurrence of other at or after 1, 0 if none.
split: ARRAY[STRING]
effective function
Split the string into an array of words.
split_in (words: COLLECTION[STRING])
effective procedure
Same jobs as split but result is appended in words.
new_iterator: ITERATOR[CHARACTER]
effective function
intern: FIXED_STRING
deferred function
A shared version of this string.
to_external: POINTER
deferred function
The address of a memory region containing the text of Current, useful to interact with the C language.
same_string (other: ABSTRACT_STRING): BOOLEAN
effective function
(Here for ELKS compatibility.)
string: STRING
effective function
(Here for ELKS compatibility.)
hash_code: INTEGER_32
deferred function
The hash-code value of Current.
in_range (lower: NATIVELY_STORED_STRING, upper: NATIVELY_STORED_STRING): BOOLEAN
effective function
Return True if Current is in range [lower..upper]
See also min, max, compare.
min (other: NATIVELY_STORED_STRING): NATIVELY_STORED_STRING
effective function
Minimum of Current and other.
max (other: NATIVELY_STORED_STRING): NATIVELY_STORED_STRING
effective function
Maximum of Current and other.
bounded_by (a_min: NATIVELY_STORED_STRING, a_max: NATIVELY_STORED_STRING): NATIVELY_STORED_STRING
effective function
A value that is equal to Current if it is between the limits set by a_min and a_max.
enumerate: ENUMERATE[E_]
effective function
get_new_iterator: ITERATOR[E_]
frozen
effective function
for_each (action: PROCEDURE[TUPLE[TUPLE 1[E_]]])
effective procedure
Apply action to every item of Current.
for_all (test: FUNCTION[TUPLE[TUPLE 1[E_]]]): BOOLEAN
effective function
Do all items satisfy test?
exists (test: FUNCTION[TUPLE[TUPLE 1[E_]]]): BOOLEAN
effective function
Does at least one item satisfy test?
aggregate (action: FUNCTION[TUPLE[TUPLE 2[E_, E_], E_]], initial: E_): E_
effective function
Aggregate all the elements starting from the initial value.
generation: INTEGER_32
writable attribute
do_all (action: ROUTINE[TUPLE[TUPLE 1[E_]]])
frozen
effective procedure
Apply action to every item of Current.
valid_index (i: INTEGER_32): BOOLEAN
effective function
True when i is valid (i.e., inside actual bounds).
recycle
deferred procedure
Do whatever needs to be done to free resources or recycle other objects when recycling this one