ReplaceAll not working in WebApp

I simply want to get rid of all spaces of a string.

Did the following, and it does not work.
origName = origName.ReplaceAll(" “,”")

Also, tried the following to replace space with underscore, and it also doesn’t work.
origName = origName.ReplaceAll(" “,”_")

Does the replaceall not work for web apps?

Thanks

Try the regular function first:

replaceall(origName," ","")

Also, check to make sure the string has an encoding.