?
Solved

StringReplace

Posted on 2000-03-29
9
Medium Priority
?
799 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 2

Expert Comment

by:aubs
ID: 2666474
According to help it resides in SysUtils.
0
 
LVL 2

Expert Comment

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

Expert Comment

by:ckaneta
ID: 2666609
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Accepted Solution

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

Pure ASM , much faster.

Regards
Umulig
0
 
LVL 1

Author Comment

by:pr_wainwright
ID: 2676075
Edited text of question.
0
 
LVL 1

Author Comment

by:pr_wainwright
ID: 2676146
Adjusted points from 50 to 100
0
 
LVL 4

Expert Comment

by:Radler
ID: 2681085
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
ID: 2681111
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
ID: 2689630
Thanks, Delphi 3.02 does not have the ReplaceString function in it's SysUtils.pas file. This alternative worked fine.

   Paul.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month14 days, 19 hours left to enroll

770 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