When creating posts, I use this macro to do transformation like that: Augment or Transform Text
I also use it within the Keyboard Maestro editor frequently to do transformations like this
local_Text → %Variable%local_Text%
On the topics of tokens, you might also find this macro useful: Insert Token