Example:
val double = " 6 ".toDouble()
val int = " 6 ".toInt()
The second declaration causes the following Exception:
Exception in thread "main" java.lang.NumberFormatException: For input string: " 6 "
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Integer.parseInt(Integer.java:654)
at java.base/java.lang.Integer.parseInt(Integer.java:786)
at MainKt.main(Main.kt:9)
Are there any reasons why they didn't decide to either allow Strings to contain spaces or not for every type of number?