thank you very much for your help. Your solution worked great. I just need to work out two more things.
Firstly, how to replace each character of each word with a hyphen “-” instead of a blank space with a border on the bottom. I’m sorry this didn’t become clearer in my other post. It looked much clearer in the editor than in the finished post.
Secondly, and perhaps more important, how to call the function in a template and supply the argument “sentence” from a row in a .csv file.