String manipulation in arduino IDE - Noob question

"How would I do that in a function?"

What do you mean? Copy those lines into the setup function or write another function to do it. Am I missing something?