OCLOperatorsSize () : Integer
This page was created by Peter on 2019-11-22. Last edited by Wikiadmin on 2026-07-29.
You can use Size() : Integer in OCL to count the characters in a text value when defining expressions in MDriven Designer.
Syntax
text.Size()text is the value on which you call the operator. The operator returns an Integer: the number of characters that compose that value.
Examples
| Expression | Result | Explanation |
|---|---|---|
'MDriven'.Size()
|
7
|
The text MDriven contains seven characters.
|
'Order 42'.Size()
|
8
|
The space between Order and 42 is a character and is included in the count.
|
.Size()
|
0
|
Empty text contains no characters. |
Use character count for text
Use Size() when you need the length of a text value. For example, this expression tests whether a customer-entered code has exactly six characters:
self.Code.Size() = 6Do not use this text operator to count related objects. To count elements in a collection, use size() instead. For example, self.Orders->size() counts the orders associated with self.
