Similar Posts

Subscribe
Notify of
5 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
jo135
1 year ago

Array or string or what?

Strips all non-printable characters from the beginning and the end of the string. …

https://docs.godotengine.org/en/stable/classes/class_string.html#class-string-method-strip-edges

Shows are obviously printable. For example, look at rstrip() and lstrip().

Mikaaaaaaaaaaa
1 year ago

To remove the quotation marks from your array and output the elements as a string, you can create a function iterated by the array, convert each element to a string and merge the results. Here’s an example how you could do this:

func array_to_string(arr: Array) -> String:

var s = “”

for i in arr:

s += str(i).replace(“\”, “”) + “, “

return s.strip_edges(“, “)

In this function, the `replace()` method is used to remove the quotes, and `strip_edges()` to remove the last comma and spaces. You can then call this function as follows:

var world = [“Hello World”, “Hello World2”]

print(array_to_string(welt)) # Issue: Hello World, Hello World2

This method removes all quotation marks in the elements of the array and outputs the elements as a string separated by comma.