Parse Integer

Last modified: August 7, 2023

1 Introduction

This document describes the function that converts a string to a value that is of data type Integer/Long.

2 parseInteger

Takes a string and parses it to an Integer/Long.

2.1 Input Parameters

The input parameters are described in the table below:

Value Type
The string to parse String
Default value (optional) Integer/Long

2.2 Output

The output is described in the table below:

Value Type
An Integer/Long if it is possible to parse it from the string. If the string cannot be parsed to an Integer/Long, the default value will be returned. If no default value is provided, an error will occur. Integer/Long

2.3 Examples

The examples below illustrate which value the expression returns:

  • If you use the following input:

    1
    
    parseInteger('42')
    

    the output is:

    1
    
    42
    
  • If you use the following input:

    1
    
    parseInteger('not_an_integer', 42)
    

    the output is:

    1
    
    42