Write a method name lastValueFromString
that accepts a String
containing one or more lines, each containing an
integer value, and returns the last value as an Int
.
The values may have whitespace around them!
For example, given the String
:
1
2
4
You should return 4
.
You can assume that the passed String
contains at least one line, and has no blank lines or lines
that do not contain an integer value.
Stuck? You may find these lessons helpful: