Note that you're much better off with a regex:

Code:
//echo -a $regsubex(Hello !._~/ world,/[^a-z0-9 ]/ig,_)