blob: 6d99e090dd0642fc587241380037061d55632702 [file] [log] [blame]
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>String Functions &mdash; Apache AGE master documentation</title>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/custom.css" type="text/css" />
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Aggregation Functions" href="aggregate_functions.html" />
<link rel="prev" title="Trigonometric Functions" href="trigonometric_functions.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home"> Apache AGE
<img src="../_static/logo.png" class="logo" alt="Logo"/>
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption" role="heading"><span class="caption-text">Introduction</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../intro/overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/setup.html">Setup</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/graphs.html">Graphs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/cypher.html">The AGE Cypher Query Format</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/types.html">Data Types - An Introduction to agtype</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/comparability.html">Comparability, Equality, Orderability and Equivalence</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/operators.html">Operators</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/aggregation.html">Aggregation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/agload.html">Importing graph from files</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Clauses</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../clauses/match.html">MATCH</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/with.html">WITH</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/return.html">RETURN</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/order_by.html">ORDER BY</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/skip.html">SKIP</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/limit.html">LIMIT</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/create.html">CREATE</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/delete.html">DELETE</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/set.html">SET</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/remove.html">REMOVE</a></li>
<li class="toctree-l1"><a class="reference internal" href="../clauses/merge.html">MERGE</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Functions</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="predicate_functions.html">Predicate Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="scalar_functions.html">Scalar Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="list_functions.html">List Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="numeric_functions.html">Numeric Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="logarithmic_functions.html">Logarithmic Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="trigonometric_functions.html">Trigonometric Functions</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">String Functions</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#replace">replace</a></li>
<li class="toctree-l2"><a class="reference internal" href="#split">split</a></li>
<li class="toctree-l2"><a class="reference internal" href="#left">left</a></li>
<li class="toctree-l2"><a class="reference internal" href="#right">right</a></li>
<li class="toctree-l2"><a class="reference internal" href="#substring">substring</a></li>
<li class="toctree-l2"><a class="reference internal" href="#rtrim">rTrim</a></li>
<li class="toctree-l2"><a class="reference internal" href="#ltrim">lTrim</a></li>
<li class="toctree-l2"><a class="reference internal" href="#trim">trim</a></li>
<li class="toctree-l2"><a class="reference internal" href="#tolower">toLower</a></li>
<li class="toctree-l2"><a class="reference internal" href="#toupper">toUpper</a></li>
<li class="toctree-l2"><a class="reference internal" href="#reverse">reverse</a></li>
<li class="toctree-l2"><a class="reference internal" href="#tostring">toString</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="aggregate_functions.html">Aggregation Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="user_functions.html">User defined functions</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">AGE Beyond Cypher</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../advanced/advanced_overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="../advanced/advanced.html">Using Cypher in a CTE Expression</a></li>
<li class="toctree-l1"><a class="reference internal" href="../advanced/advanced.html#using-cypher-in-a-join-expression">Using Cypher in a Join expression</a></li>
<li class="toctree-l1"><a class="reference internal" href="../advanced/advanced.html#cypher-in-sql-expressions">Cypher in SQL expressions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../advanced/prepared_statements.html">Prepared Statements</a></li>
<li class="toctree-l1"><a class="reference internal" href="../advanced/plpgsql.html">PL/pgSQL Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../advanced/sql_in_cypher.html">SQL In Cypher</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Contributing</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../contributing/run_tests.html">Run the test suite</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">Apache AGE</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li>String Functions</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/apache/incubator-age-website/blob/master/docs/functions/string_functions.md" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="tex2jax_ignore mathjax_ignore section" id="string-functions">
<h1>String Functions<a class="headerlink" href="#string-functions" title="Permalink to this headline"></a></h1>
<div class="section" id="replace">
<h2>replace<a class="headerlink" href="#replace" title="Permalink to this headline"></a></h2>
<p>replace() returns a string in which all occurrences of a specified string in the original string have been replaced by another (specified) string.</p>
<p>Syntax: **<code>replace(original, search, replace)</code></strong></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="n">String</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>original
</td>
<td>An expression that returns a string.
</td>
</tr>
<tr>
<td>search
</td>
<td>An expression that specifies the string to be replaced in original.
</td>
</tr>
<tr>
<td>replace
</td>
<td>An expression that specifies the replacementstring.
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>If any argument is null, null will be returned.</p></li>
<li><p>If search is not found in original, original will be returned.</p></li>
</ul>
<table>
<tr>
</tr>
</table>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN replace(&#39;hello&#39;, &#39;l&#39;, &#39;w&#39;)
$$) as (str_array agtype);
</pre></div>
</div>
<p>Result:</p>
<table>
<tr>
<td>new_str
</td>
</tr>
<tr>
<td>“Hewwo”
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="split">
<h2>split<a class="headerlink" href="#split" title="Permalink to this headline"></a></h2>
<p>split() returns a list of strings resulting from the splitting of the original string around matches of the given delimiter.</p>
<p>Syntax: <code class="docutils literal notranslate"><span class="pre">split(original,</span> <span class="pre">split_delimiter)</span></code></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="nb">list</span> <span class="n">of</span> <span class="n">agtype</span> <span class="n">strings</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>original
</td>
<td>An expression that returns a string.
</td>
</tr>
<tr>
<td>split_delimiter
</td>
<td>The string with which to split original.
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>split(null, splitDelimiter) and split(original, null) both return null</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN split(&#39;one,two&#39;, &#39;,&#39;)
$$) as (split_list agtype);
</pre></div>
</div>
<p>Result:</p>
<table>
<tr>
<td><strong>split_list</strong>
</td>
</tr>
<tr>
<td>[“one”,”two”]
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="left">
<h2>left<a class="headerlink" href="#left" title="Permalink to this headline"></a></h2>
<p>left() returns a string containing the specified number of leftmost characters of the original string.</p>
<p>Syntax: <code class="docutils literal notranslate"><span class="pre">left(original,</span> <span class="pre">length)</span></code></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="n">String</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>original
</td>
<td>An expression that returns a string.
</td>
</tr>
<tr>
<td>n
</td>
<td>An expression that returns a positive integer.
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>left(null, length) and left(null, null) both return null</p></li>
<li><p>left(original, null) will raise an error.</p></li>
<li><p>If length is not a positive integer, an error is raised.</p></li>
<li><p>If length exceeds the size of original, original is returned.</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN left(&#39;Hello&#39;, 3)
$$) as (new_str agtype);
</pre></div>
</div>
<p>Result:</p>
<table>
<tr>
<td>new_str
</td>
</tr>
<tr>
<td>“Hel”
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="right">
<h2>right<a class="headerlink" href="#right" title="Permalink to this headline"></a></h2>
<p>right() returns a string containing the specified number of rightmost characters of the original string.</p>
<p>Syntax: <code class="docutils literal notranslate"><span class="pre">right(original,</span> <span class="pre">length)</span></code></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="n">String</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>original
</td>
<td>An expression that returns a string.
</td>
</tr>
<tr>
<td>n
</td>
<td>An expression that returns a positive integer.
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>right(null, length) and right(null, null) both return null</p></li>
<li><p>right(original, null) will raise an error.</p></li>
<li><p>If length is not a positive integer, an error is raised.</p></li>
<li><p>If length exceeds the size of original, original is returned.</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN right(&#39;hello&#39;, 3)
$$) as (new_str agtype);
</pre></div>
</div>
<p>Result:</p>
<table>
<tr>
<td>new_str
</td>
</tr>
<tr>
<td>“llo”
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="substring">
<h2>substring<a class="headerlink" href="#substring" title="Permalink to this headline"></a></h2>
<p>substring() returns a substring of the original string, beginning with a 0-based index start and length.</p>
<p>Syntax: <code>substring(original, <strong>start</strong> [, <strong>length</strong>])</code></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="n">String</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>original
</td>
<td>An expression that returns a string.
</td>
</tr>
<tr>
<td>start
</td>
<td>An expression denoting the position at which the substring will begin.
</td>
</tr>
<tr>
<td>length
</td>
<td>An optional expression that returns a positive integer, denoting how many characters of the original expression will be returned.
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>start uses a zero-based index.</p></li>
<li><p>If length is omitted, the function returns the substring starting at the position given by start and extending to the end of original.</p></li>
<li><p>If original is null, null is returned.</p></li>
<li><p>If either start or length is null or a negative integer, an error is raised.</p></li>
<li><p>If start is 0, the substring will start at the beginning of original.</p></li>
<li><p>If length is 0, the empty string will be returned.</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN substring(&#39;hello&#39;, 1, 3), substring(&#39;hello&#39;, 2)
$$) as (sub_str1 agtype, sub_str2 agtype);
</pre></div>
</div>
<p>Result:</p>
<table>
<tr>
<td>sub_str1
</td>
<td>sub_str2
</td>
</tr>
<tr>
<td>‘ell’
</td>
<td>‘llo’
</td>
</tr>
<tr>
<td colspan="2" >1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="rtrim">
<h2>rTrim<a class="headerlink" href="#rtrim" title="Permalink to this headline"></a></h2>
<p>rTrim() returns the original string with trailing whitespace removed.</p>
<p>Syntax: rTrim(original)</p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="n">String</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>original
</td>
<td>An expression that returns a string
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>rTrim(null) returns null</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN rTrim(&#39; hello &#39;)
$$) as (trimmed_str agtype);
</pre></div>
</div>
<p>Result:</p>
<table>
<tr>
<td>trimmed_str
</td>
</tr>
<tr>
<td>" hello"
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="ltrim">
<h2>lTrim<a class="headerlink" href="#ltrim" title="Permalink to this headline"></a></h2>
<p>lTrim() returns the original string with trailing whitespace removed.</p>
<p>Syntax: <code class="docutils literal notranslate"><span class="pre">lTrim(original)</span></code></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">A</span> <span class="n">String</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>original
</td>
<td>An expression that returns a string
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>lTrim(null) returns null</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN lTrim(&#39; hello &#39;)
$$) as (trimmed_str agtype);
</pre></div>
</div>
<p>Result:</p>
<table>
<tr>
<td>left_trimmed_str
</td>
</tr>
<tr>
<td>“hello ”
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="trim">
<h2>trim<a class="headerlink" href="#trim" title="Permalink to this headline"></a></h2>
<p>trim() returns the original string with leading and trailing whitespace removed.</p>
<p>Syntax: <code class="docutils literal notranslate"><span class="pre">trim(original)</span></code></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="n">String</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>original
</td>
<td>An expression that returns a string
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>trim(null) returns null</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN trim(&#39; hello &#39;)
$$) as (trimmed_str agtype);
</pre></div>
</div>
<p>Result:</p>
<table>
<tr>
<td>trimmed_str
</td>
</tr>
<tr>
<td>“hello”
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="tolower">
<h2>toLower<a class="headerlink" href="#tolower" title="Permalink to this headline"></a></h2>
<p>toLower() returns the original string in lowercase.</p>
<p>Syntax: <code class="docutils literal notranslate"><span class="pre">toLower(original)</span></code></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="n">String</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>original
</td>
<td>An expression that returns a string
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>toLower(null) returns null</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN toLower(&#39;HELLO&#39;)
$$) as (lower_str agtype);
</pre></div>
</div>
<p>Result:</p>
<table>
<tr>
<td>lower_str
</td>
</tr>
<tr>
<td>“hello”
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="toupper">
<h2>toUpper<a class="headerlink" href="#toupper" title="Permalink to this headline"></a></h2>
<p>toUpper() returns the original string in lowercase.</p>
<p>Syntax: <code class="docutils literal notranslate"><span class="pre">toUpper(original)</span></code></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="n">String</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>original
</td>
<td>An expression that returns a string
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>toUpper(null) returns null</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN toUpper(&#39;hello&#39;)
$$) as (upper_str agtype);
</pre></div>
</div>
<p>Result:</p>
<table>
<tr>
<td><code>upper_str</code>
</td>
</tr>
<tr>
<td>“HELLO”
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="reverse">
<h2>reverse<a class="headerlink" href="#reverse" title="Permalink to this headline"></a></h2>
<p>reverse() returns a string in which the order of all characters in the original string have been reversed.</p>
<p>Syntax: <code class="docutils literal notranslate"><span class="pre">reverse(original)</span></code></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">An</span> <span class="n">agtype</span> <span class="n">String</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>original
</td>
<td>An expression that returns a string
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>reverse(null) returns null.</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN reverse(&quot;hello&quot;)
$$) as (upper_str agtype);
</pre></div>
</div>
<p>Result:</p>
<table>
<tr>
<td>upper_str
</td>
</tr>
<tr>
<td>“olleh”
</td>
</tr>
<tr>
<td>1 row(s) returned
</td>
</tr>
</table>
</div>
<div class="section" id="tostring">
<h2>toString<a class="headerlink" href="#tostring" title="Permalink to this headline"></a></h2>
<p>toString() converts an integer, float or boolean value to a string.</p>
<p>Syntax:<code class="docutils literal notranslate"><span class="pre">toString(expression)</span></code></p>
<p>Returns:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">A</span> <span class="n">String</span><span class="o">.</span>
</pre></div>
</div>
<p>Arguments:</p>
<table>
<tr>
<td>Name
</td>
<td>Description
</td>
</tr>
<tr>
<td>expression
</td>
<td>An expression that returns a number, a boolean, or a string.
</td>
</tr>
</table>
<p>Considerations:</p>
<ul class="simple">
<li><p>toString(null) returns null</p></li>
<li><p>If expression is a string, it will be returned unchanged.</p></li>
</ul>
<p>Query:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>SELECT *
FROM cypher(&#39;graph_name&#39;, $$
RETURN toString(11.5),toString(&#39;a string&#39;), toString(true)
$$) as (float_to_str agtype, str_to_str agtype, bool_to_string);
</pre></div>
</div>
<p>Result:</p>
<table>
<tr>
<td>float_to_str
</td>
<td>str_to_str
</td>
<td>bool_to_str
</td>
</tr>
<tr>
<td>"11.5"
</td>
<td>"a string"
</td>
<td>"true"
</td>
</tr>
<tr>
<td colspan="3" >1 row(s) returned
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="aggregate_functions.html" class="btn btn-neutral float-right" title="Aggregation Functions" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="trigonometric_functions.html" class="btn btn-neutral float-left" title="Trigonometric Functions" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&#169; Copyright 2021, Apache AGE.
</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Other Versions</span>
v: manual-link
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
<dl>
<dt>Versions</dt>
<dd><a href="../../documentation-staging/index.html">documentation-staging</a></dd>
<dd><a href="string_functions.html">manual-link</a></dd>
<dd><a href="../../master/index.html">master</a></dd>
<dd><a href="../../v0.6.0/index.html">v0.6.0</a></dd>
</dl>
</div>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>