Transferring part of the text to another node (Label, RichtextLabel, TextEdit)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GIN

I want to understand how to transfer the text to another node that did not fit in the first node. For example, there is some big test and I need to split it so that one part goes to one node and the other to another node.

:bust_in_silhouette: Reply From: alexandremassaro

You could do something like this:

 func _ready():
	var big_text = "Lorem ipsum dolor sit amet"
	var arr_str : Array = text_split(big_text, 2)

	while arr_str.size():

 func text_split(text : String, size : int):
	var text_array : Array

	while text.length() > size:
		text_array.append(text.substr(0, size - 1))
		text = text.substr(size)
	if text.length():
		text = ""

	return text_array