Solved

StringReplace

Posted on 2000-03-29
9
768 Views
Last Modified: 2010-04-04
I have compiled a Delphi package which references the function StringReplace.
I get a compile time error of 'undeclared  identifier'. I know that StringReplace is a standard Delphi function but i cannot seem to find it, nor does the Delphi help have any reference to it. Could anyone tell me which unit StringReplace is in ?. I am using Delphi 3.02 Professional.

P.S I have a copy of C++ Builder 4 which has the 'StringReplace' function in the SysUtils file. Is it possible to call this from a Delphi application?.

     Thanks Paul.
0
Comment
Question by:pr_wainwright
9 Comments
 
LVL 2

Expert Comment

by:aubs
Comment Utility
According to help it resides in SysUtils.
0
 
LVL 2

Expert Comment

by:NetoMan
Comment Utility
Yes... Actually it resides in all versions in SysUtils.pas
0
 
LVL 3

Expert Comment

by:ckaneta
Comment Utility
here ya go, from the help files:
---------------------------------------

Returns a string with occurrences of one substring replaced by another substring.

Unit

Sysutils

Category

string handling routines

type
  TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase);
function StringReplace(const S, OldPattern, NewPattern: string; Flags: TReplaceFlags): string;

Description

StringReplace replaces occurrences of the substring specified by OldPattern with the substring specified by NewPattern. StringReplace assumes that the source string, specified by S, may contain Multibyte characters.

If the Flags parameter does not include rfReplaceAll, StringReplace only replaces the first occurrence of OldPattern in S. Otherwise, all instances of OldPattern are replaced by NewPattern.

If the Flags parameter includes rfIgnoreCase, The comparison operation is case insensitive.
0
 
LVL 1

Accepted Solution

by:
umulig earned 100 total points
Comment Utility
if you are gone use it , you should check out.
http://www.gracie.org.uk/delphi/
Faststrings

Pure ASM , much faster.

Regards
Umulig
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:pr_wainwright
Comment Utility
Edited text of question.
0
 
LVL 1

Author Comment

by:pr_wainwright
Comment Utility
Adjusted points from 50 to 100
0
 
LVL 4

Expert Comment

by:Radler
Comment Utility
Hi pr_wainwright,

Seems easy solve your problem.
If you're using CBuilder then open then source file header,
example : Unit1.cpp-->Unit1.hpp and put the follow line
<#include SysUtils.hpp>

Now any reference to StringReplace at Unit1 is fixed.

Now if you're Using Delphi 3.02 locate the "uses" clause of each unit that make reference ot StringReplace and add
SysUtils at the end of the line. like this
uses
 ..., Windows, ...., SysUtils;

T++, Radler.
0
 
LVL 4

Expert Comment

by:Radler
Comment Utility
Hi pr_wainwright,

Seems easy solve your problem.
If you're using CBuilder then open then source file header,
example : Unit1.cpp-->Unit1.hpp and put the follow line
<#include SysUtils.hpp>

Now any reference to StringReplace at Unit1 is fixed.

Now if you're Using Delphi 3.02 locate the "uses" clause of each unit that make reference ot StringReplace and add
SysUtils at the end of the line. like this
uses
 ..., Windows, ...., SysUtils;

T++, Radler.
0
 
LVL 1

Author Comment

by:pr_wainwright
Comment Utility
Thanks, Delphi 3.02 does not have the ReplaceString function in it's SysUtils.pas file. This alternative worked fine.

   Paul.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now