kotlin string get last character code example Example: kotlin get last line of string paragraph.substring(paragraph.lastIndexOf("\n"))