This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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.

in Engine by (17 points)

1 Answer

0 votes

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
by (22 points)
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 Frequently asked questions and 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 [email protected] with your username.