Here is the simple way to remove a particular special char from a string.

var s = “aaa'”;

if (s[s.length-1] == ‘-‘ || s[s.length-1] == ‘\”) {

s = s.substring(0, s.length – 1);

}

alert(s);

Here is the fiddle