OCLOperators subSequence
m ((username removed) (log details removed): Moving to Documentation namespace)
(Replacing message template with parser tag)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<message>Write the content here to display this box</message>
=== subSequence ( startIndex : Integer, endIndex : Integer ) : Sequence(T) ===
=== subSequence ( startIndex : Integer, endIndex : Integer ) : Sequence(T) ===
Returns a Sequence containing all elements of ''self'' between the positions 'startIndex' and 'endIndex'.
Returns a Sequence containing all elements of ''self'' between the positions 'startIndex' and 'endIndex'.
Line 22: Line 23:
If you supply index values outside the source collection, the result collection will be empty.
If you supply index values outside the source collection, the result collection will be empty.
[[Category:OCL Collection Operators]]
[[Category:OCL Collection Operators]]
{{Edited|July|12|2024}}

Latest revision as of 07:52, 17 June 2024

subSequence ( startIndex : Integer, endIndex : Integer ) : Sequence(T)

Returns a Sequence containing all elements of self between the positions 'startIndex' and 'endIndex'.

Expression Result
Sequence{'a', 'b', 'c', 'd'}->subSequence(2, 3) Sequence{'b', 'c'}
Sequence{'a', 'b', 'c', 'd'}->subSequence(4, 4) Sequence{'d'}

Returns a smaller collection from start to stop.

subSequence(<start>, <stop>)

Please note that the index number is 1-based.

Example:

Sequence{1..20}->subSequence(10,15)

The expression above will return numbers 10, 11, 12, 13, 14, and 15.

If you supply index values outside the source collection, the result collection will be empty.

This page was edited 95 days ago on 06/17/2024. What links here