Parse
(Created page with "Most value types, for example Integer and Decimal has a function "parse" to convert a string into a value. ====== Example ====== You use it as follows; Decimal.parse('10')...")
 
No edit summary
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Most value types, for example Integer and Decimal has 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, [[Documentation:Integer|Integer]] and [[Documentation:Decimal|Decimal]] - have a function "parse" to convert a string into a value.


====== Example ======
====== Example ======
You use it as follows;
Use as follows:
  Decimal.parse('10')
  Decimal.parse('10')
  Integer.parse('5')
  Integer.parse('5')


====== Error handling ======
====== Error Handling ======
If the provided string isn't convertible to the type, the resulting value is NULL.
If the provided string isn't convertible to the type, the resulting value is NULL.
  Decimal.parse('x').isNull
  Decimal.parse('x').isNull
Returns true.
Returns true.
[[Category:OCLOperators]]
[[Category:OCL]]
{{Edited|July|12|2025}}

Latest revision as of 05:02, 22 January 2025

This page was created by Lars.olofsson@mdriven.net on 2020-11-25. Last edited by Stephanie@mdriven.net on 2025-01-22.

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.