removing character space from a btn lable to create an object with the name (without any spaces in the object name)

Hi all.

I’ve a table array being sent to a function.
I want the function to turn the button lable as shown below into an object name.

    local btnLabels = {
        [1] = “Start Game”,
        [2] = “Instructions”,
        [3] = “Game Options”,
        [4] = “Store”,
        [5] = “About”
        }
 

then in my function…

        local createBtnName = “btn”…fontStyle.text

For items in [2], [4] and [5] this apends the lable with “btn” at the start. All is good.
But for items in [1] and [3] there are two words with a space. How do I remove this space?

eg I need something like…
 

        local createBtnName = “btn”…(removeSpace(fontStyle.text))

is there a function that does this already? whats its name?

I goal is that I want to end up with these object names:

btnStartGame

btnInstructions

btnGameOptions

btnStore

btnAbout

 

Thanks

https://stackoverflow.com/questions/10460126/how-to-remove-spaces-from-a-string-in-lua

https://stackoverflow.com/questions/10460126/how-to-remove-spaces-from-a-string-in-lua