Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
StringReplace function Posted by lee_s on 27 Feb 2005 at 5:53 AM
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?

Report
Re: StringReplace function Posted by zibadian on 27 Feb 2005 at 5:56 AM
: 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.
Report
Re: StringReplace function Posted by lee_s on 27 Feb 2005 at 6:04 AM
: : 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, ',' ,'","' , ?????);
Report
Re: StringReplace function Posted by zibadian on 27 Feb 2005 at 6:06 AM
This message was edited by zibadian at 2005-2-27 6:8:41

: : : 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:
  strLine := StringReplace(strLine, ',' ,'","' , [rfIgnoreCase]);

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.
Report
Re: StringReplace function Posted by lee_s on 27 Feb 2005 at 6:13 AM
: This message was edited by zibadian at 2005-2-27 6:8:41

: : : : 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:
:
:   strLine := StringReplace(strLine, ',' ,'","' , [rfIgnoreCase]);
: 

: 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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.