• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 833
  • Last Modified:

StringReplace

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
pr_wainwright
Asked:
pr_wainwright
1 Solution
 
aubsCommented:
According to help it resides in SysUtils.
0
 
NetoManCommented:
Yes... Actually it resides in all versions in SysUtils.pas
0
 
ckanetaCommented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
umuligCommented:
if you are gone use it , you should check out.
http://www.gracie.org.uk/delphi/
Faststrings

Pure ASM , much faster.

Regards
Umulig
0
 
pr_wainwrightAuthor Commented:
Edited text of question.
0
 
pr_wainwrightAuthor Commented:
Adjusted points from 50 to 100
0
 
RadlerCommented:
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
 
RadlerCommented:
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
 
pr_wainwrightAuthor Commented:
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 to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now