Parse
No edit summary
(Replacing message template with parser tag)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Most value types - for example, Integer and Decimal - have a function "parse" to convert a string into a value.
<message>Write the content here to display this box</message>
Most value types - for example, [[Integer]] and [[Decimal]] - have a function "parse" to convert a string into a value.


====== Example ======
====== Example ======
Use it as follows:
Use as follows:
  Decimal.parse('10')
  Decimal.parse('10')
  Integer.parse('5')
  Integer.parse('5')
Line 12: Line 13:
[[Category:OCLOperators]]
[[Category:OCLOperators]]
[[Category:OCL]]
[[Category:OCL]]
{{Edited|July|12|2024}}

Latest revision as of 07:53, 17 June 2024

Most value types - for example, Integer and Decimal - have a function "parse" to convert a string into a value.

Example

Use as follows:

Decimal.parse('10')
Integer.parse('5')
Error Handling

If the provided string isn't convertible to the type, the resulting value is NULL.

Decimal.parse('x').isNull

Returns true.

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