How to get the last element from array if present. In below code num contains array of elements
var line_ = ln.trim if(!line_.isEmpty) { var num = line_.split(" "); }
Just use last
:
var num = line_.split(" ").last;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With