1. Home
  2. Computing & Technology
  3. Delphi Programming
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

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

WrapText

unit
Sysutils
category
string handling routines

declaration
type TSysCharSet = set of Char;

function WrapText(const StrLine, BreakStr: string; BreakChars: TSysCharSet; MaxCol: integer): string; overload;

function WrapText(const StrLine: string; MaxCol: integer = 45): string; overload;

description
Returns a string broken into multiple lines.

Each line of text in StrLine is broken when a line reaches MaxCol characters.
BreakStr is inserted in the string after a series of BreakChar characters at the end of the line, to create a line break.
If the BreakStr and BreakChars parameters are omitted, WrapText searches for space, hyphen, or tab characters on which to break the line and inserts a carriage return/line feed pair (#13#10) at the break points.

example
var s : string;

s:='BreakStr is inserted in the string after
a series of BreakChar characters at the end
of the line, to create a line break.';

s := WrapText(s, #13#10, ['.',' ',#9,'-'], 30);

//s=BreakStr is inserted in the
//  string after a series of
//  BreakChar characters at the
//  end of the line, to create
//  a line break.

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?
Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.