View source code
Display the source code in std/string.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function std.string.wrap
Wrap text into a paragraph.
The input text string s
is formed into a paragraph
by breaking it up into a sequence of lines, delineated
by \n, such that the number of columns
is not exceeded
on each line.
The last line is terminated with a \n.
Prototype
S wrap(S)( S s, size_t columns = 80, S firstindent = null, S indent = null, size_t tabsize = 8 ) pure @safe if (isSomeString!S);
Parameters
Name | Description |
---|---|
s | text string to be wrapped |
columns | maximum number of columns in the paragraph |
firstindent | string used to indent first line of the paragraph |
indent | string to use to indent following lines of the paragraph |
tabsize | column spacing of tabs in firstindent [] and indent [] |
Returns
resulting paragraph as an allocated string
Authors
Walter Bright, Andrei Alexandrescu, and Jonathan M Davis