0 votes

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.

in Engine by (71 points)
reshown by

1 Answer

+1 vote
Best answer

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])
by (5,212 points)
selected by

That was it, thank you!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.