For my coding, I need to automatically replace possible spaces from value labels during processing in my do file.

Some inspiration I got from this blog post entry #3 by Nick Cox:
Code:
. di stritrim("South           Africa")
South Africa
So, maybe I am ignorant, but, I assumed that this would give the result that I am looking for:
Code:
. di subinstr("South Africa", " ", "_")
invalid syntax
r(198);
But, this clearly is not correct.

So, my question is: what code would replace space(s) in a string by another character like an underscore (_)?