-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplit-func.html
More file actions
58 lines (56 loc) · 2.33 KB
/
split-func.html
File metadata and controls
58 lines (56 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>SPLIT Function - SQL Notebook</title>
<link rel="stylesheet" href="sqlnotebook.css">
</head>
<body>
<header>
<table class="nav">
<tr>
<td>
<a href="index.html"><img src="art/SqlNotebookIcon.png" alt="SQL Notebook (logo)" style="width: 58px; height: 58px; float: left; margin-right: 20px;"></a>
</td>
<td>
<a href="index.html" id="title">SQL Notebook</a><br>
<nav>
<ul class="nav">
<li><a href="https://github.com/brianluft/sqlnotebook/releases">Download</a></li>
<li><a href="doc.html"><span id="header-doc-long">Documentation</span><span id="header-doc-short">Docs</span></a></li>
<li><a href="https://github.com/brianluft/sqlnotebook">GitHub</a></li>
</ul>
</nav>
</td>
</tr>
</table>
<hr style="margin-top: 15px; margin-bottom: 15px;">
</header>
<article><div id="article">
<h1><code>SPLIT</code> Function</h1>
<p>Splits a string by a caller-specified separator and either returns the substrings as an <a href=
"array-func.html">array</a>, or returns one specific substring.</p>
<h2>Syntax</h2><code>SPLIT(<i>text</i>, <i>separator</i>, [<i>which-substring</i>])</code><br>
<h2>Parameters</h2>
<ul class="args">
<li><i>text</i>: text<br>
The string to split up.</li>
<li><i>separator</i>: text<br>
The string that separates each substring in <i>text</i>.</li>
<li><i>which-substring</i>: integer (optional, non-negative)<br>
The index of the substring to return. A <i>which-substring</i> value of 0 will return the first substring, 1 will
return the second substring, and so on. If no such substring exist in the original string, then <code>NULL</code>
is returned.</li>
</ul>
<h2>Return Value</h2>If <i>which-substring</i> is provided, then the specified substring is returned. If it is not
provided, then an array of all the substrings is returned.<br>
<h2>Example</h2>
<pre>PRINT SPLIT('AAA|BBB|CCC', '|', 1); <i>-- "BBB"</i><br>PRINT SPLIT('AAA|BBB|CCC', '|', 5); <i>-- NULL</i><br>PRINT SPLIT('AAA|BBB|CCC', '|'); <i>-- "[AAA, BBB, CCC]"</i><br></pre>
</div></article>
<footer><div id="footer">
<hr>
© 2016-2025 <a href="https://github.com/electroly">Brian Luft</a>
</div></footer>
</body>
</html>