Home > front end >  Vala - How to join string[] to string?
Vala - How to join string[] to string?

Time:07-06

I have a string array:

string[] arr = {"Hello", "World"};

I want to print it or convert it to a string like:

print(arr.join(","));

> "Hello,World"

How can I do this?

CodePudding user response:

Use string.joinv():

string[] arr = {"Hello", "World"};

print(string.joinv(",", arr));

Result:

Hello,World
  • Related