mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 22:50:38 +03:00
phobos 0.158
This commit is contained in:
parent
ab805df217
commit
02ee34661a
7 changed files with 56 additions and 6 deletions
2
std.ddoc
2
std.ddoc
|
@ -17,7 +17,7 @@ DDOC = <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|||
|
||||
<body>
|
||||
<div id="heading">
|
||||
<a href="http://www.digitalmars.com/" target="_top"><img src="../dmlogo.gif" width="270" height="53" border="0" alt="www.digitalmars.com" /></a>
|
||||
<a href="http://www.digitalmars.com/" target="_top"><img src="../dmlogo.gif" width="270" height="53" border="0" alt="www.digitalmars.com"></a>
|
||||
|
||||
<a href="http://www.digitalmars.com/" title="www.digitalmars.com" target="_top">Home</a>
|
||||
| <a href="http://www.digitalmars.com/advancedsearch.html" title="Search Digital Mars web site" target="_top">Search</a>
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
/* Written by Walter Bright, Christopher E. Miller, and many others.
|
||||
* www.digitalmars.com
|
||||
* Placed into public domain.
|
||||
* Linux(R) is the registered trademark of Linus Torvalds in the U.S. and other
|
||||
* countries.
|
||||
*/
|
||||
|
||||
module std.c.linux.linux;
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
|
||||
// Copyright (C) 2003 by Digital Mars, www.digitalmars.com
|
||||
// All Rights Reserved
|
||||
// Written by Walter Bright
|
||||
/* Written by Walter Bright.
|
||||
* www.digitalmars.com
|
||||
* Placed into public domain.
|
||||
* Linux(R) is the registered trademark of Linus Torvalds in the U.S. and other
|
||||
* countries.
|
||||
*/
|
||||
|
||||
/* These are all the globals defined by the linux C runtime library.
|
||||
* Put them separate so they'll be externed - do not link in linuxextern.o
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
|
||||
/* Windows is a registered trademark of Microsoft Corporation in the United
|
||||
States and other countries. */
|
||||
|
||||
module std.c.windows.windows;
|
||||
|
||||
version (Windows)
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
/**********************************************
|
||||
* $(LINK2 ../../../ctg/regular.html, Regular expressions)
|
||||
* $(LINK2 http://www.digitalmars.com/ctg/regular.html, Regular expressions)
|
||||
* are a powerful method of string pattern matching.
|
||||
* The regular expression
|
||||
* language used is the same as that commonly used, however, some of the very
|
||||
|
|
42
std/string.d
42
std/string.d
|
@ -3690,6 +3690,30 @@ unittest
|
|||
* in one of a known set of strings, and the program will helpfully
|
||||
* autocomplete the string once sufficient characters have been
|
||||
* entered that uniquely identify it.
|
||||
* Example:
|
||||
* ---
|
||||
* import std.stdio;
|
||||
* import std.string;
|
||||
*
|
||||
* void main()
|
||||
* {
|
||||
* static char[][] list = [ "food", "foxy" ];
|
||||
*
|
||||
* auto abbrevs = std.string.abbrev(list);
|
||||
*
|
||||
* foreach (key, value; abbrevs)
|
||||
* {
|
||||
* writefln("%s => %s", key, value);
|
||||
* }
|
||||
* }
|
||||
* ---
|
||||
* produces the output:
|
||||
* <pre>
|
||||
* fox => foxy
|
||||
* food => food
|
||||
* foxy => foxy
|
||||
* foo => food
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
char[][char[]] abbrev(char[][] values)
|
||||
|
@ -3804,6 +3828,20 @@ unittest
|
|||
|
||||
/******************************************
|
||||
* 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.
|
||||
* Params:
|
||||
* 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
|
||||
* Returns:
|
||||
* The resulting paragraph.
|
||||
*/
|
||||
|
||||
char[] wrap(char[] s, int columns = 80, char[] firstindent = null,
|
||||
|
@ -3863,7 +3901,7 @@ char[] wrap(char[] s, int columns = 80, char[] firstindent = null,
|
|||
result ~= '\n';
|
||||
result ~= indent;
|
||||
}
|
||||
else
|
||||
else if (result.length != firstindent.length)
|
||||
result ~= ' ';
|
||||
result ~= s[wordstart .. s.length];
|
||||
}
|
||||
|
@ -3883,6 +3921,8 @@ unittest
|
|||
assert(wrap(" a bc df ", 3) == "a\nbc\ndf\n");
|
||||
//writefln("'%s'", wrap(" abcd df ",3));
|
||||
assert(wrap(" abcd df ", 3) == "abcd\ndf\n");
|
||||
assert(wrap("x") == "x\n");
|
||||
assert(wrap("u u") == "u u\n");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
* $(LINK2 http://www.digitalmars.com/d/ascii-table.html, ASCII Table),
|
||||
* $(LINK2 http://en.wikipedia.org/wiki/Unicode, Wikipedia),
|
||||
* $(LINK2 http://www.unicode.org, The Unicode Consortium)
|
||||
* Trademarks:
|
||||
* Unicode(tm) is a trademark of Unicode, Inc.
|
||||
*/
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue