Home > Mobile >  Replacing the character in strings with apostrophes Google sheets
Replacing the character in strings with apostrophes Google sheets

Time:03-02

I have strings in my data like so: bachelors

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!

enter image description here

Thanks for any help on this

Goole sheet shawing an expample enter image description here

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),"'")

enter image description here

  • Related