title: Insert an emoji inside a string in Delphi 2007
body: <p>I'm trying to do exactly what the title say, insert an emoji into a string in Delphi 2007, just like the example below :</p>
  
  <pre><code>procedure TForm1.Button1Click(Sender: TObject);
  var s : string;
  begin
  s := 'This is my original string (y)';
  s := ansireplacestr(s,'(y)','');
  showmessage(s);
  end;
  </code></pre>
  
  <p>I can even paste the emoji into IDE's code, but in runtime showmessage results in this :</p>
  
  <p>This is my original string ????</p>
  
  <p>Is there a way to achieve this task in Delphi 2007 ? Due to several reasons i can't upgrade Delphi right now.</p>
  
  <p>Someone said my question is solved on this topic :</p>
  
  <p><a href="https://stackoverflow.com/questions/383195/handling-a-unicode-string-in-delphi-versions-2007">Handling a Unicode String in Delphi Versions &lt;= 2007</a></p>
  
  <p>But this topic just says to use third-party components, without telling exactly how to do it.</p>
  
  <p>EDIT : After suggested, i tried to use the functions pos, delete and insert and a widestring var :</p>
  
  <pre><code>function addEmoji(mystring : widestring) : widestring;
  var r, aux : widestring;
  p : integer;
  begin
  r := mystring;
  while pos('(y)',r) &gt; 0 do
    begin
      aux := r;
      p := pos('(y)',aux);
      Insert('',aux,p);
      delete(aux,pos('(y)',aux),3);
      r := aux;
    end;
  result := r;
  end;
  </code></pre>
  
  <p>But the result is the '(y)' replaced by '????'.</p>