Files
dotfiles/cabal/share/doc/x86_64-osx-ghc-7.10.1/MissingH-1.3.0.1/html/Data-String-Utils.html
2015-04-05 17:47:08 +02:00

19 lines
12 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.String.Utils</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-String-Utils.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">MissingH-1.3.0.1: Large utility library</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>Copyright (C) 2004-2011 John Goerzen</td></tr><tr><th>License</th><td>BSD3</td></tr><tr><th>Maintainer</th><td>John Goerzen &lt;jgoerzen@complete.org&gt;</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Portability</th><td>portable</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.String.Utils</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Whitespace Removal</a></li><li><a href="#g:2">Tests</a></li><li><a href="#g:3">Conversions</a></li><li><a href="#g:4">Reading</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This module provides various helpful utilities for dealing with strings.</p><p>Written by John Goerzen, jgoerzen@complete.org</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:strip">strip</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:lstrip">lstrip</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:rstrip">rstrip</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:startswith">startswith</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Eq.html#t:Eq">Eq</a> a =&gt; [a] -&gt; [a] -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:endswith">endswith</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Eq.html#t:Eq">Eq</a> a =&gt; [a] -&gt; [a] -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:join">join</a> :: [a] -&gt; [[a]] -&gt; [a]</li><li class="src short"><a href="#v:split">split</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Eq.html#t:Eq">Eq</a> a =&gt; [a] -&gt; [a] -&gt; [[a]]</li><li class="src short"><a href="#v:splitWs">splitWs</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -&gt; [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]</li><li class="src short"><a href="#v:replace">replace</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Eq.html#t:Eq">Eq</a> a =&gt; [a] -&gt; [a] -&gt; [a] -&gt; [a]</li><li class="src short"><a href="#v:escapeRe">escapeRe</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li><li class="src short"><a href="#v:maybeRead">maybeRead</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Text-Read.html#t:Read">Read</a> a =&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a</li></ul></div><div id="interface"><h1 id="g:1">Whitespace Removal</h1><div class="top"><p class="src"><a name="v:strip" class="def">strip</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></p><div class="doc"><p>Removes any whitespace characters that are present at the start
or end of a string. Does not alter the internal contents of a
string. If no whitespace characters are present at the start or end
of a string, returns the original string unmodified. Safe to use on
any string.</p><p>Note that this may differ from some other similar
functions from other authors in that:</p><ol><li>If multiple whitespace
characters are present all in a row, they are all removed;</li><li>If no
whitespace characters are present, nothing is done.</li></ol></div></div><div class="top"><p class="src"><a name="v:lstrip" class="def">lstrip</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></p><div class="doc"><p>Same as <code><a href="Data-String-Utils.html#v:strip">strip</a></code>, but applies only to the left side of the string.</p></div></div><div class="top"><p class="src"><a name="v:rstrip" class="def">rstrip</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></p><div class="doc"><p>Same as <code><a href="Data-String-Utils.html#v:strip">strip</a></code>, but applies only to the right side of the string.</p></div></div><h1 id="g:2">Tests</h1><div class="doc"><p>Note: These functions are aliases for functions
in <a href="Data-List-Utils.html">Data.List.Utils</a>.</p></div><div class="top"><p class="src"><a name="v:startswith" class="def">startswith</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Eq.html#t:Eq">Eq</a> a =&gt; [a] -&gt; [a] -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>Returns true if the given list starts with the specified elements;
false otherwise. (This is an alias for &quot;Data.List.isPrefixOf&quot;.)</p><p>Example:</p><pre>startswith &quot;He&quot; &quot;Hello&quot; -&gt; True</pre></div></div><div class="top"><p class="src"><a name="v:endswith" class="def">endswith</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Eq.html#t:Eq">Eq</a> a =&gt; [a] -&gt; [a] -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Bool.html#t:Bool">Bool</a></p><div class="doc"><p>Returns true if the given list ends with the specified elements;
false otherwise. (This is an alias for &quot;Data.List.isSuffixOf&quot;.)</p><p>Example:</p><pre>endswith &quot;lo&quot; &quot;Hello&quot; -&gt; True</pre></div></div><h1 id="g:3">Conversions</h1><div class="doc"><p>Note: Some of these functions are aliases for functions
in <a href="Data-List-Utils.html">Data.List.Utils</a>.</p></div><div class="top"><p class="src"><a name="v:join" class="def">join</a> :: [a] -&gt; [[a]] -&gt; [a]</p><div class="doc"><p>Given a delimiter and a list of items (or strings), join the items
by using the delimiter.</p><p>Example:</p><pre>join &quot;|&quot; [&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;] -&gt; &quot;foo|bar|baz&quot;</pre></div></div><div class="top"><p class="src"><a name="v:split" class="def">split</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Eq.html#t:Eq">Eq</a> a =&gt; [a] -&gt; [a] -&gt; [[a]]</p><div class="doc"><p>Given a delimiter and a list (or string), split into components.</p><p>Example:</p><pre>split &quot;,&quot; &quot;foo,bar,,baz,&quot; -&gt; [&quot;foo&quot;, &quot;bar&quot;, &quot;&quot;, &quot;baz&quot;, &quot;&quot;]</pre><pre>split &quot;ba&quot; &quot;,foo,bar,,baz,&quot; -&gt; [&quot;,foo,&quot;,&quot;r,,&quot;,&quot;z,&quot;]</pre></div></div><div class="top"><p class="src"><a name="v:splitWs" class="def">splitWs</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -&gt; [<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]</p><div class="doc"><p>Splits a string around whitespace. Empty elements in the result
list are automatically removed. </p></div></div><div class="top"><p class="src"><a name="v:replace" class="def">replace</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Eq.html#t:Eq">Eq</a> a =&gt; [a] -&gt; [a] -&gt; [a] -&gt; [a]</p><div class="doc"><p>Given a list and a replacement list, replaces each occurance of the search
list with the replacement list in the operation list.</p><p>Example:</p><pre>replace &quot;,&quot; &quot;.&quot; &quot;127,0,0,1&quot; -&gt; &quot;127.0.0.1&quot;</pre><p>This could logically be thought of as:</p><pre>replace old new l = join new . split old $ l</pre></div></div><div class="top"><p class="src"><a name="v:escapeRe" class="def">escapeRe</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></p><div class="doc"><p>Escape all characters in the input pattern that are not alphanumeric.</p><p>Does not make special allowances for NULL, which isn't valid in a
Haskell regular expression pattern. </p></div></div><h1 id="g:4">Reading</h1><div class="top"><p class="src"><a name="v:maybeRead" class="def">maybeRead</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Text-Read.html#t:Read">Read</a> a =&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a</p><div class="doc"><p>Attempts to parse a value from the front of the string.</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.0</p></div></body></html>