Warning: Adding string methods is *broken* in Atlas PR1, although it should work with Atlas PR2 and later.
// Same as substFirst but as a string method function subst1(c1, c2) { if (this == "") return this // find the character string var i = this.indexOf(c1) // return original string if not found if (i < 0) return this // extract the characters before and after the string var s1 = (""+this).substring(0, i) var s2 = (""+this).substring(i+1, this.length) return s1+c2+s2 } // Add to the string class String.subst1 = subst1 // For early versions of navigator "".subst1 = subst1