[#util-Split-00]
= xref:util.adoc[util]::Split
:relfileprefix: ../
:mrdocs:

Split a string on any char found in separators, returning a vector&period;

== Synopsis

Declared in `&lt;util&sol;string&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename T = std::span&lt;char const&gt;&gt;
std::vector&lt;T&gt;
Split(
    std::span&lt;char const&gt; const& sp,
    std::string&lowbar;view separators,
    bool include&lowbar;sep = false);
----

== Description

If sep does not occur in sp, a singleton with the entirety of sp is returned&period;

Note that this function does not care about braces, so splitting &quot;foo(bar(1),2),3) on &apos;,&apos; will return &lcub;&quot;foo(bar(1)&quot;, &quot;2)&quot;, &quot;3)&quot;&rcub;&period;

If include&lowbar;sep &equals;&equals; true, splitting &quot;foo(bar(1),2),3) on &apos;,&apos; will return&colon;

* foo(bar(1),
* 2),
* 3)

== Return Value

The pieces of sp between separators&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *include&lowbar;sep* [in]
| Whether to include the separator at the end of the left side of the splits&period;
| *sp* [in]
| The input character range to split&period;
| *separators* [in]
| Set of characters, any of which splits the input&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
