Question : single quotes double quotes in Delphi

How to replace first occurence in string of ' to '' in Delphi using Stringreplace?
Oldstring has ' somwhere in it like 5'8
and I want it to be 5''8.
Thanks.

Answer : single quotes double quotes in Delphi

That's

StringReplace -- the function
oldString -- what you want to replace
'''' -- four single quotes in a row, outer ones to denote a string, middle two = 1 single single-quote
'"' -- two outer singles, one inner double
[rfReplaceAll] -- argument to StringReplace to change all instances of single quotes found

StringReplace does not change the source string, unless you assign the result back to the old string.

example usage:

var  oldString, newString: string;
begin
oldString := '5''8';
newString := StringReplace(oldString, '''', '"', [rfReplaceAll]);
Random Solutions  
 
programming4us programming4us