ocaml-containers/3.1/containers/CCString/Split/index.html
2020-12-05 11:17:01 -05:00

2 lines
No EOL
8.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Split (containers.CCString.Split)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> <a href="../../index.html">containers</a> &#x00BB; <a href="../index.html">CCString</a> &#x00BB; Split</nav><h1>Module <code>CCString.Split</code></h1><nav class="toc"><ul><li><a href="#copying-functions">Copying functions</a></li></ul></nav></header><dl><dt class="spec type" id="type-drop_if_empty"><a href="#type-drop_if_empty" class="anchor"></a><code><span class="keyword">type</span> drop_if_empty</code><code> = </code><code>{</code><table class="record"><tr id="type-drop_if_empty.first" class="anchored"><td class="def field"><a href="#type-drop_if_empty.first" class="anchor"></a><code>first : bool;</code></td></tr><tr id="type-drop_if_empty.last" class="anchored"><td class="def field"><a href="#type-drop_if_empty.last" class="anchor"></a><code>last : bool;</code></td></tr></table><code>}</code></dt><dd><p>Specification of what to do with empty blocks, as in <code>split ~by:&quot;-&quot; &quot;-a-b-&quot;</code>.</p><ul><li><code>{first=false; last=false}</code> will return <code>&quot;&quot;; &quot;a&quot;; &quot;b&quot;; &quot;&quot;</code></li><li><code>{first=true; last=false}</code> will return <code>&quot;a&quot;; &quot;b&quot; &quot;&quot;</code></li><li><code>{first=false; last=true}</code> will return <code>&quot;&quot;; &quot;a&quot;; &quot;b&quot;</code></li><li><code>{first=true; last=true}</code> will return <code>&quot;a&quot;; &quot;b&quot;</code></li></ul><p>The default value of all remaining functions is <code>Drop_none</code>.</p><dl><dt>since</dt><dd>1.5</dd></dl></dd></dl><dl><dt class="spec value" id="val-no_drop"><a href="#val-no_drop" class="anchor"></a><code><span class="keyword">val</span> no_drop : <a href="index.html#type-drop_if_empty">drop_if_empty</a></code></dt><dd><p>Do not drop any group, even empty and on borders.</p><dl><dt>since</dt><dd>1.5</dd></dl></dd></dl><dl><dt class="spec value" id="val-list_"><a href="#val-list_" class="anchor"></a><code><span class="keyword">val</span> list_ : <span>?&#8288;drop:<a href="index.html#type-drop_if_empty">drop_if_empty</a></span> <span>&#45;&gt;</span> <span>by:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span><span>(string * int * int)</span> list</span></code></dt><dd><p>Split the given string along the given separator <code>by</code>. Should only be used with very small separators, otherwise use <span class="xref-unresolved" title="unresolved reference to &quot;Containers_string.KMP&quot;"><code>Containers_string</code>.KMP</span>.</p><dl><dt>returns</dt><dd><p>a list of slices <code>(s,index,length)</code> that are separated by <code>by</code>. <span class="xref-unresolved" title="unresolved reference to &quot;String.sub&quot;"><code>String</code>.sub</span> can then be used to actually extract a string from the slice.</p></dd></dl><dl><dt>raises Failure</dt><dd><p>if <code>by = &quot;&quot;</code>.</p></dd></dl></dd></dl><dl><dt class="spec value" id="val-gen"><a href="#val-gen" class="anchor"></a><code><span class="keyword">val</span> gen : <span>?&#8288;drop:<a href="index.html#type-drop_if_empty">drop_if_empty</a></span> <span>&#45;&gt;</span> <span>by:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span><span>(string * int * int)</span> <a href="../index.html#type-gen">gen</a></span></code></dt><dt class="spec value" id="val-iter"><a href="#val-iter" class="anchor"></a><code><span class="keyword">val</span> iter : <span>?&#8288;drop:<a href="index.html#type-drop_if_empty">drop_if_empty</a></span> <span>&#45;&gt;</span> <span>by:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span><span>(string * int * int)</span> <a href="../index.html#type-iter">iter</a></span></code></dt><dd><dl><dt>since</dt><dd>2.8</dd></dl></dd></dl><dl><dt class="spec value" id="val-seq"><a href="#val-seq" class="anchor"></a><code><span class="keyword">val</span> seq : <span>?&#8288;drop:<a href="index.html#type-drop_if_empty">drop_if_empty</a></span> <span>&#45;&gt;</span> <span>by:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span><span>(string * int * int)</span> Stdlib.Seq.t</span></code></dt><dd><p>Renamed from <code>std_seq</code> since 3.0.</p><dl><dt>since</dt><dd>3.0</dd></dl></dd></dl><section><header><h5 id="copying-functions"><a href="#copying-functions" class="anchor"></a>Copying functions</h5><p>Those split functions actually copy the substrings, which can be more convenient but less efficient in general.</p></header><dl><dt class="spec value" id="val-list_cpy"><a href="#val-list_cpy" class="anchor"></a><code><span class="keyword">val</span> list_cpy : <span>?&#8288;drop:<a href="index.html#type-drop_if_empty">drop_if_empty</a></span> <span>&#45;&gt;</span> <span>by:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span>string list</span></code></dt><dt class="spec value" id="val-gen_cpy"><a href="#val-gen_cpy" class="anchor"></a><code><span class="keyword">val</span> gen_cpy : <span>?&#8288;drop:<a href="index.html#type-drop_if_empty">drop_if_empty</a></span> <span>&#45;&gt;</span> <span>by:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span>string <a href="../index.html#type-gen">gen</a></span></code></dt><dt class="spec value" id="val-iter_cpy"><a href="#val-iter_cpy" class="anchor"></a><code><span class="keyword">val</span> iter_cpy : <span>?&#8288;drop:<a href="index.html#type-drop_if_empty">drop_if_empty</a></span> <span>&#45;&gt;</span> <span>by:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span>string <a href="../index.html#type-iter">iter</a></span></code></dt><dd><dl><dt>since</dt><dd>2.8</dd></dl></dd></dl><dl><dt class="spec value" id="val-seq_cpy"><a href="#val-seq_cpy" class="anchor"></a><code><span class="keyword">val</span> seq_cpy : <span>?&#8288;drop:<a href="index.html#type-drop_if_empty">drop_if_empty</a></span> <span>&#45;&gt;</span> <span>by:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span>string Stdlib.Seq.t</span></code></dt><dd><p>Renamed from <code>std_seq_cpy</code> since 3.0.</p><dl><dt>since</dt><dd>3.0</dd></dl></dd></dl><dl><dt class="spec value" id="val-left"><a href="#val-left" class="anchor"></a><code><span class="keyword">val</span> left : <span>by:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span><span>(string * string)</span> option</span></code></dt><dd><p>Split on the first occurrence of <code>by</code> from the leftmost part of the string.</p><dl><dt>since</dt><dd>0.12</dd></dl></dd></dl><dl><dt class="spec value" id="val-left_exn"><a href="#val-left_exn" class="anchor"></a><code><span class="keyword">val</span> left_exn : <span>by:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> string * string</code></dt><dd><p>Split on the first occurrence of <code>by</code> from the leftmost part of the string.</p><dl><dt>raises Not_found</dt><dd><p>if <code>by</code> is not part of the string.</p></dd></dl><dl><dt>since</dt><dd>0.16</dd></dl></dd></dl><dl><dt class="spec value" id="val-right"><a href="#val-right" class="anchor"></a><code><span class="keyword">val</span> right : <span>by:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span><span>(string * string)</span> option</span></code></dt><dd><p>Split on the first occurrence of <code>by</code> from the rightmost part of the string.</p><dl><dt>since</dt><dd>0.12</dd></dl></dd></dl><dl><dt class="spec value" id="val-right_exn"><a href="#val-right_exn" class="anchor"></a><code><span class="keyword">val</span> right_exn : <span>by:string</span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> string * string</code></dt><dd><p>Split on the first occurrence of <code>by</code> from the rightmost part of the string.</p><dl><dt>raises Not_found</dt><dd><p>if <code>by</code> is not part of the string.</p></dd></dl><dl><dt>since</dt><dd>0.16</dd></dl></dd></dl></section></div></body></html>