I have strings in my data like so: bachelor’
s
It is a rectangle with an X through it (you can't really see the X here) it is showing up where curly
apostrophes existed in the data
I am having trouble replacing the character ’
with an apostrophe '
If I do a G search on this ’
the closest match I find is
Symbol ⌧
Name x in a rectangle box
Unicode number U 2327
I tried replacing these with a script using
str.replace(/[\U2327]/g, "'");
Or
str.replace(/[\U 2327]/g, "'");
But nither work
Hmm, I see that the character is acutely being turned into an apostrophe in the post!
Thanks for any help on this
Goole sheet shawing an expample
In this particular case the symbol is \u0092
:
function main2() {
var sheet = SpreadsheetApp.getActiveSheet();
var text = sheet.getRange('a1').getValue();
var new_text = text.replace(/\u0092/g, "'");
sheet.getRange('a3').setValue(new_text)
}
CodePudding user response:
The code ascii appears to be 146
Try
=SUBSTITUTE(A1,char(146),"'")