Skip to content
Advertisement

LocalDate.parse can’t parse the character on the last index wehere there is no character (nor empty space)

I have in my notepad file text:

JavaScript

I checked is there any empty spaces, there is none.

When I write:

JavaScript

I receive an error:

JavaScript

But there is no index 10! Why it thinks there is index[10]?

Advertisement

Answer

Trim possible whitespaces before parsing the date using String::trim:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement