Einzelnen Beitrag anzeigen

piedad

Registriert seit: 5. Jun 2020
10 Beiträge
 
#1

how to use the option flag rfReplaceAll in ReplaceStr

  Alt 25. Jun 2020, 16:39
Hallo Guys,
I Need some help. I am trying something very simple: to build a function to calculate the email addresse from the first Name and last Name for a loop in a QDA Batch.
Since i am Living in Germany know, I am using the german Keyboard, so I have to replace my ä with ae, and so on.
Not a big deal. But trying to use the Option rfReplaceAll I am getting stucked.
I tried to define it as a type, as a set, Nothing is working with an Syntax Error. Could you give me a hint? I am sure it is because a Little type Definition and I am new in Delphi.:
Many thanks in Advance and best regards
Piedad

Here is my last code

// calculate the email adresse from the related PErson
function eMailAdresseCalculator(Person: String): string ;
type
TReplaceFlags = [rfReplaceAll, rfIgnoreCase];
var
FirstName : String;
LastName : String
joint : Index;
options : TReplaceFlags;

begin

joint := Pos(' ', Person);
FirstName:= LowerCase(Trim(LeftStr(Person,joint)));
LastName := LowerCase(Trim(RightStr(Person,(Length(Person)-joint))));
options := rfReplaceAll;

Result := FirstName + '.' + LastName +'@Firma.com';
Result := ReplaceStr(Result,'ä','ae',options);
Result := ReplaceStr(Result,'ö','oe',options);
Result := ReplaceStr(Result,'ü','ue',options);

end;
  Mit Zitat antworten Zitat