Lisaac prototype interface

Section Header
+ name := STRING;
- comment := "String library.";
Section Inherit
- parent_abstract_string:ABSTRACT_STRING :=
- parent_arrayed:ARRAYED :=
Section ABSTRACT_STRING, ABSTRACT_ENTRY
+ storage:NATIVE_ARRAY[CHARACTER];
Section Public
+ count:INTEGER;
+ capacity:INTEGER;
General :
- set_storage tab:NATIVE_ARRAY[CHARACTER] <-
Creation / Modification :
- create needed_capacity:INTEGER :SELF <-
- create_from_string str:ABSTRACT_STRING :SELF <-
- make needed_capacity:INTEGER <-
Initialize the string to have at least `needed_capacity'
characters of storage.
- make_empty <-
Create an empty string
- create_filled (c:CHARACTER,n:INTEGER) :SELF <-
- make_filled (c:CHARACTER,n:INTEGER) <-
Initialize string with `n` copies of `c`
- twin:STRING <-
Modification :
- resize new_count:INTEGER <-
Resize self. When `new_count' is greater than `count',
new positions are initialized with the default value of CHARACTER
- set_capacity new_capacity:INTEGER <-
Resize `capacity' self, but not count.
- clear <-
Clear out the current STRING.
Note: internal `storage' memory is neither released nor shrunk.
- copy other:ABSTRACT_STRING<-
Copy `other' onto Current.
- fill_with c:CHARACTER <-
Replace every character with `c'.
- replace_all old_char:CHARACTER with new_char:CHARACTER <-
Replace all occurrences of the element `old_char' by `new_character'
- append other:ABSTRACT_STRING <-
Append `other' to Current.
- prepend other:ABSTRACT_STRING <-
Prepend `other' to Current
- insert_string s:ABSTRACT_STRING to i:INTEGER <-
Insert `s' at index `i', shifting characters from index `i'
to `count' rightwards.
- replace_substring s:ABSTRACT_STRING from start:INTEGER to end:INTEGER <-
Replace the substring from start to end, inclusive, with s
- put ch:CHARACTER to index:INTEGER<-
Put `ch' at position `index'.
- swap i1:INTEGER with i2: INTEGER <-
- insert ch:CHARACTER to index:INTEGER <-
Insert `ch' after position `index'.
- insert ch:CHARACTER to index:INTEGER on nb:INTEGER <-
Insert `ch' after position `index'.
- shrink min_index:INTEGER to max_index:INTEGER <-
Keep only the slice [`min_index' .. `max_index'] or nothing
when the slice is empty.
- remove index:INTEGER <-
Remove character at position `index'.
- add_first ch: CHARACTER <-
Add `ch' at first position.
- add_last ch:CHARACTER <-
Append `ch' to string
- append_character c:CHARACTER <-
- extend c:CHARACTER <-
- to_lower <-
Convert all characters to lower case.
- to_upper <-
Convert all characters to upper case.
- keep_head n:INTEGER <-
Remove all characters except for the first `n'.
Do nothing if `n' >= `count'.
- keep_tail n:INTEGER <-
Remove all characters except for the last `n'.
Do nothing if `n' >= `count'.
- remove_first n:INTEGER <-
Remove `n' first characters.
If `n' >= `count', remove all.
- remove_between start:INTEGER to end:INTEGER <-
Remove all characters from `strt_index' to `end_index' inclusive.
- remove_suffix s:ABSTRACT_STRING <-
Remove the suffix `s' of current string.
- remove_last n:INTEGER <-
- remove_tail n:INTEGER <-
- remove_prefix s:ABSTRACT_STRING <-
Remove the prefix `s' of current string.
- left_adjust <-
Remove leading blanks.
- right_adjust <-
Remove trailing blanks.
- extend_multiple c:CHARACTER by n:INTEGER <-
Extend Current with `n' times character `c'.
- precede_multiple c:CHARACTER by n:INTEGER <-
Prepend `n' times character `c' to Current.
- extend_to_count c:CHARACTER until needed_count:INTEGER <-
Extend Current with `c' until `needed_count' is reached.
Do nothing if `needed_count' is already greater or equal
to `count'.
- precede_to_count c:CHARACTER until needed_count:INTEGER <-
Prepend `c' to Current until `needed_count' is reached.
Do nothing if `needed_count' is already greater or equal
to `count'.
- reverse <-
Reverse the string.
- remove_all_occurrences ch:CHARACTER <-
Remove all occurrences of `ch'.
- extend_unless ch:CHARACTER <-
Extend `Current' (using `extend') with `ch' unless `ch' is
already the `last' character.
- make_from_string model:ABSTRACT_STRING <-
Initialize from the characters of `model'.
Useful in proper descendants of STRING.
- set_count new_count:INTEGER <-
Interfacing with C string :
- to_external:NATIVE_ARRAY[CHARACTER] <-
Gives C access to the internal `storage' (may be dangerous).
To be compatible with C, a null character is added at the end
of the internal `storage'. This extra null character is not
part of the Eiffel STRING.
- from_external p:NATIVE_ARRAY[CHARACTER] <-
Internal `storage' is set using `p' (may be dangerous because
the external C string `p' is not duplicated).
Assume `p' has a null character at the end in order to
compute the Eiffel `count'. This extra null character
is not part of the Eiffel STRING.
Also consider `from_external_copy' to choose the most appropriate.
- from_external_copy p:NATIVE_ARRAY[CHARACTER] <-
Internal `storage' is set using a copy of `p'.
Assume `p' has a null character at the end in order to
compute the Eiffel `count'. This extra null character
is not part of the Eiffel STRING.
Also consider `from_external' to choose the most appropriate.
Guru section.
- element_sizeof:INTEGER <-
- add_last_buffer buf:FAST_ARRAY[UINTEGER_8] from beg:INTEGER to end:INTEGER <-
- item_byte idx:INTEGER offset ofs:INTEGER :UINTEGER_8 <-
- restore_after_external <-