1. Computing
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?

©2014 About.com. All rights reserved.