Solved

StringReplace

Posted on 2000-03-29
9
777 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
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 1

Accepted Solution

by:
umulig earned 100 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 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

11 Experts available now in Live!

Get 1:1 Help Now