1. Tech

Your suggestion is on its way!

An email with a link to:

http://delphi.about.com/library/rtl/blrtlStringReplace.htm

was emailed to:

Thanks for sharing About.com with others!

Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

StringReplace

unit
Sysutils
category
string handling routines

declaration
type TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase);

function StringReplace(const S, OldStr, NewStr: string; Flags: TReplaceFlags): string;

description
Returns a string in which a specified substring has been replaced with another substring.

If the Flags parameter does not include rfReplaceAll, only the first occurrence of OldStr in S is replaced. Otherwise, all instances of OldStr are replaced by NewStr.
If the Flags parameter includes rfIgnoreCase, the comparison operation is case insensitive.

example
var s : string;

s:='VB programmers love About VB Programming site';
s := ReplaceStr(s,'VB','Delphi', [rfReplaceAll]);
//s='Delphi programmers love
    About Delphi Programming site';

in real code
String Types in Delphi
Understanding and managing string data types in Delphi's Object Pascal. Learn about differences between Short, Long, Wide and null-terminated strings.

see also


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?

©2014 About.com. All rights reserved.