Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

StringReplace function

lee_slee_s Posts: 116Member
What am i doing wrong :

type
TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase);
var
strLine : string;
Flags : TReplaceFlags;
Begin
strLine := StringReplace(strLine, ',' ,'","' , Flags);

It's says that the Flags is not good.
What should i do?

Comments

  • zibadianzibadian Posts: 6,349Member
    : What am i doing wrong :
    :
    : type
    : TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase);
    : var
    : strLine : string;
    : Flags : TReplaceFlags;
    : Begin
    : strLine := StringReplace(strLine, ',' ,'","' , Flags);
    :
    : It's says that the Flags is not good.
    : What should i do?
    :
    :
    You don't need to define the TReplaceFlags. They are already defined by Delphi. The last parameter is either a variable of the type TReplaceFlags or a set constructor.
  • lee_slee_s Posts: 116Member
    : : What am i doing wrong :
    : :
    : : type
    : : TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase);
    : : var
    : : strLine : string;
    : : Flags : TReplaceFlags;
    : : Begin
    : : strLine := StringReplace(strLine, ',' ,'","' , Flags);
    : :
    : : It's says that the Flags is not good.
    : : What should i do?
    : :
    : :
    : You don't need to define the TReplaceFlags. They are already defined by Delphi. The last parameter is either a variable of the type TReplaceFlags or a set constructor.
    :

    How do i write in the param list ?
    strLine := StringReplace(strLine, ',' ,'","' , ?????);
  • zibadianzibadian Posts: 6,349Member
    [b][red]This message was edited by zibadian at 2005-2-27 6:8:41[/red][/b][hr]
    : : : What am i doing wrong :
    : : :
    : : : type
    : : : TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase);
    : : : var
    : : : strLine : string;
    : : : Flags : TReplaceFlags;
    : : : Begin
    : : : strLine := StringReplace(strLine, ',' ,'","' , Flags);
    : : :
    : : : It's says that the Flags is not good.
    : : : What should i do?
    : : :
    : : :
    : : You don't need to define the TReplaceFlags. They are already defined by Delphi. The last parameter is either a variable of the type TReplaceFlags or a set constructor.
    : :
    :
    : How do i write in the param list ?
    : strLine := StringReplace(strLine, ',' ,'","' , ?????);
    :
    I normally use a set constructor. This makes the replace to look something like this:
    [code]
    strLine := StringReplace(strLine, ',' ,'","' , [rfIgnoreCase]);
    [/code]
    Set constructors are detailed in the help files.
    Also not that 2 different declarations of type are NOT the same. Thus your TReplaceFlags is not the same as the SysUtils' TReplaceFlags.
  • lee_slee_s Posts: 116Member
    : [b][red]This message was edited by zibadian at 2005-2-27 6:8:41[/red][/b][hr]
    : : : : What am i doing wrong :
    : : : :
    : : : : type
    : : : : TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase);
    : : : : var
    : : : : strLine : string;
    : : : : Flags : TReplaceFlags;
    : : : : Begin
    : : : : strLine := StringReplace(strLine, ',' ,'","' , Flags);
    : : : :
    : : : : It's says that the Flags is not good.
    : : : : What should i do?
    : : : :
    : : : :
    : : : You don't need to define the TReplaceFlags. They are already defined by Delphi. The last parameter is either a variable of the type TReplaceFlags or a set constructor.
    : : :
    : :
    : : How do i write in the param list ?
    : : strLine := StringReplace(strLine, ',' ,'","' , ?????);
    : :
    : I normally use a set constructor. This makes the replace to look something like this:
    : [code]
    : strLine := StringReplace(strLine, ',' ,'","' , [rfIgnoreCase]);
    : [/code]
    : Set constructors are detailed in the help files.
    : Also not that 2 different declarations of type are NOT the same. Thus your TReplaceFlags is not the same as the SysUtils' TReplaceFlags.
    :

    Thanks you are truly great one
Sign In or Register to comment.