'How to remove the commas from an array of strings [closed]

I have a array of string arry = [ "Laptop", "mobile", "car"]

i want to make this arry = ["laptop" "mobile" "car"]

i tried it in ruby. but it doesn't matter any language as far as i can get the output in this format.



Solution 1:[1]

There are no commas in any of your values, so no matter what you do you can't remove them. The commas are instead part of the language's default formatting when turning arrays into strings.

Instead of relying on that, turn the array into a string yourself:

arry = [ "Laptop", "mobile", "car"]
s = "[" + arry.map { |x| x.downcase.dump }.join(" ") + "]"
print s

This outputs ["laptop" "mobile" "car"]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 that other guy