Q:

Ruby program to convert the array of characters into the string

belongs to collection: Ruby Strings Programs

0

In this program, we will create an array of characters. Then we will convert an array into the string using the join() function and return the result.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program/Source Code:

The source code to convert the array of characters into the string is given below. The given program is compiled and executed successfully.

# Ruby program to covert the array 
# of characters into string

arr = ['H', 'E', 'L', 'L', 'O'];
str = arr.join();

print "Str: ",str,"\n";

Output:

Str: HELLO

Explanation:

In the above program, we created an array arr. Then we used the join() function to convert an array of characters into the string and assign the result to the str variable. After that, we printed the string str.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Ruby Strings Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Ruby program to convert an integer array into a st... >>
<< Ruby program to convert the string into an array o...