Recent

Author Topic: [SOLVED] Replace en-dash e2 80 93 in a string  (Read 2972 times)

pcurtis

  • Hero Member
  • *****
  • Posts: 855
[SOLVED] Replace en-dash e2 80 93 in a string
« on: November 27, 2021, 05:46:54 pm »
How do I replace the en-dash sequence in a string with a simple -?
« Last Edit: November 28, 2021, 07:23:26 am by pcurtis »
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

Bart

  • Hero Member
  • *****
  • Posts: 4611
    • Bart en Mariska's Webstek
Re: Replace en-dash e2 80 93 in a string
« Reply #1 on: November 27, 2021, 05:57:30 pm »
StringReplaceUtf8?

Bart

pcurtis

  • Hero Member
  • *****
  • Posts: 855
Re: Replace en-dash e2 80 93 in a string
« Reply #2 on: November 27, 2021, 06:54:52 pm »
Code: Pascal  [Select][+][-]
  1. sTemp3 := #226+#128+#147;
  2. sTemp := UTF8StringReplace(sTemp, sTemp3, '*', []);
  3.  

Only half works. It removes, but doesn't replace.
« Last Edit: November 27, 2021, 07:28:25 pm by pcurtis »
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

jamie

  • Hero Member
  • *****
  • Posts: 5141
Re: Replace en-dash e2 80 93 in a string
« Reply #3 on: November 27, 2021, 08:04:03 pm »
Code: Pascal  [Select][+][-]
  1.  
  2. Var
  3.   S:string = #$e2+#$80+#$93;
  4.   SS:String;
  5. begin
  6.   SS := 'Test Line'+S;
  7.   Caption := Utf8StringReplace(SS,S,'-',[rfReplaceAll,rfIgnoreCase]);
  8. end;                                                                  
  9.  

The only true wisdom is knowing you know nothing

pcurtis

  • Hero Member
  • *****
  • Posts: 855
Re: [SOLVED] Replace en-dash e2 80 93 in a string
« Reply #4 on: November 28, 2021, 07:24:24 am »
Thanks
Windows 10 20H2
Laz 2.2.0
FPC 3.2.2

 

TinyPortal © 2005-2018