remove blank spaces in a string

can any help how to remove blank spaces in a string?

STR="GOOD BYE"

by removing blank spaces, the string should be GOOD,BYE

thanks in advance

should work, i have not tested it

Well, according to that, you want to replace the space with a comma?

echo "$STR" | tr ' ' ','
echo "$STR" | sed 's/ /,/g' # g isn't strictly needed here

Cheers
ZB