Get last (or any) line in Label

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Chain
:warning: Old Version Published before Godot 3 was released.

Hey,

I have seen a post on this forum discussing this problem, but his/her solution isn’t clear to me due to the reason that the link he provided isn’t online anymore.

Is there any way to get the last line of a Label?

Thanks in advance.

:bust_in_silhouette: Reply From: avencherus

Well one way is take the string and split it by newline character. Take the last element of the array it creates.

var s_arr = label.get_text().split("\n")
print(s_arr[s_arr.size() -1])

That was it, thank you!

Chain | 2017-08-30 08:49