ToInteger
See javadoc - uk.gov.gchq.koryphe.impl.function.ToInteger
Available since Koryphe version 1.5.0
Returns any input as Integer.
Examples
To integer
Java
JSON
Full JSON
Python
final ToInteger function = new ToInteger();{
"class" : "ToInteger"
}{
"class" : "uk.gov.gchq.koryphe.impl.function.ToInteger"
}g.ToInteger()Input type:
java.lang.Object
Example inputs:
| Input Type | Input | Result Type | Result |
|---|---|---|---|
| java.lang.Integer | 4 | java.lang.Integer | 4 |
| java.lang.Long | 5 | java.lang.Integer | 5 |
| java.lang.String | 5 | java.lang.Integer | 5 |
| java.lang.String | aString | NumberFormatException: For input string: "aString" | |
| java.util.Arrays$ArrayList | [6, 3] | IllegalArgumentException: Could not convert value to Integer: [6, 3] | |
| null | null |