308 lines
8.0 KiB
HTML
308 lines
8.0 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
<head>
|
|
<title>utils</title>
|
|
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
|
</head>
|
|
<body>
|
|
|
|
<div id="container">
|
|
|
|
<div id="product">
|
|
<div id="product_logo"></div>
|
|
<div id="product_name"><big><b></b></big></div>
|
|
<div id="product_description"></div>
|
|
</div> <!-- id="product" -->
|
|
|
|
|
|
<div id="main">
|
|
|
|
|
|
<!-- Menu -->
|
|
|
|
<div id="navigation">
|
|
<br/>
|
|
<h1>utils</h1>
|
|
|
|
<ul>
|
|
<li><a href="../index.html">Index</a></li>
|
|
</ul>
|
|
|
|
<h2>Contents</h2>
|
|
<ul>
|
|
<li><a href="#Functions">Functions</a></li>
|
|
</ul>
|
|
|
|
|
|
<h2>Modules</h2>
|
|
<ul class="$(kind=='Topics' and '' or 'nowrap'">
|
|
<li><strong>stringutil</strong></li>
|
|
<li><a href="../modules/random.html">random</a></li>
|
|
<li><a href="../modules/noisemanager.html">noisemanager</a></li>
|
|
<li><a href="../modules/nodeutil.html">nodeutil</a></li>
|
|
<li><a href="../modules/posutil.html">posutil</a></li>
|
|
<li><a href="../modules/objectrefutil.html">objectrefutil</a></li>
|
|
<li><a href="../modules/nodeboxutil.html">nodeboxutil</a></li>
|
|
<li><a href="../modules/mapmanipulator.html">mapmanipulator</a></li>
|
|
<li><a href="../modules/fisheryates.html">fisheryates</a></li>
|
|
<li><a href="../modules/textureutil.html">textureutil</a></li>
|
|
<li><a href="../modules/blockutil.html">blockutil</a></li>
|
|
<li><a href="../modules/tango.html">tango</a></li>
|
|
<li><a href="../modules/arraymanipulator.html">arraymanipulator</a></li>
|
|
<li><a href="../modules/inventoryutil.html">inventoryutil</a></li>
|
|
<li><a href="../modules/entityutil.html">entityutil</a></li>
|
|
<li><a href="../modules/scheduler.html">scheduler</a></li>
|
|
<li><a href="../modules/blockedcache.html">blockedcache</a></li>
|
|
<li><a href="../modules/mathutil.html">mathutil</a></li>
|
|
<li><a href="../modules/log.html">log</a></li>
|
|
<li><a href="../modules/arrayutil.html">arrayutil</a></li>
|
|
<li><a href="../modules/directmapmanipulator.html">directmapmanipulator</a></li>
|
|
<li><a href="../modules/rotationutil.html">rotationutil</a></li>
|
|
<li><a href="../modules/settings.html">settings</a></li>
|
|
<li><a href="../modules/pathutil.html">pathutil</a></li>
|
|
<li><a href="../modules/wallmountedutil.html">wallmountedutil</a></li>
|
|
<li><a href="../modules/interpolate.html">interpolate</a></li>
|
|
<li><a href="../modules/transform.html">transform</a></li>
|
|
<li><a href="../modules/numberutil.html">numberutil</a></li>
|
|
<li><a href="../modules/test.html">test</a></li>
|
|
<li><a href="../modules/facedirutil.html">facedirutil</a></li>
|
|
<li><a href="../modules/constants.html">constants</a></li>
|
|
<li><a href="../modules/minetestex.html">minetestex</a></li>
|
|
<li><a href="../modules/list.html">list</a></li>
|
|
<li><a href="../modules/stopwatch.html">stopwatch</a></li>
|
|
<li><a href="../modules/itemutil.html">itemutil</a></li>
|
|
<li><a href="../modules/color.html">color</a></li>
|
|
<li><a href="../modules/tableutil.html">tableutil</a></li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
<h1>Module <code>stringutil</code></h1>
|
|
<p>Various utility functions for working with strings.</p>
|
|
<p></p>
|
|
|
|
|
|
<h2><a href="#Functions">Functions</a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#concat">concat (...)</a></td>
|
|
<td class="summary">Concats all the given items by invoking tostring on them into one string.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#endswith">endswith (text, value)</a></td>
|
|
<td class="summary">Tests if the given text ends with the given value.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#hash">hash (value)</a></td>
|
|
<td class="summary">Creates a simple hash in the range of mathutil.SIGNED_32BIT_MIN and
|
|
mathutil.SIGNED_32BIT_MAX (which is roughly -2 billion to 2 billion).</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#split">split (text, split, trim_values)</a></td>
|
|
<td class="summary">Splits the given text using the given split value.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#startswith">startswith (text, value)</a></td>
|
|
<td class="summary">Tests if the given text starts with the given value.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#trim">trim (text)</a></td>
|
|
<td class="summary">Trims the given text from any leading and trailing whitespace.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
|
|
<h2><a name="Functions"></a>Functions</h2>
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "concat"></a>
|
|
<strong>concat (...)</strong>
|
|
</dt>
|
|
<dd>
|
|
Concats all the given items by invoking tostring on them into one string.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">...</span>
|
|
The items to concat.
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
The concatenated items as string.
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "endswith"></a>
|
|
<strong>endswith (text, value)</strong>
|
|
</dt>
|
|
<dd>
|
|
Tests if the given text ends with the given value.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">text</span>
|
|
The text to check if it ends with the given value.
|
|
</li>
|
|
<li><span class="parameter">value</span>
|
|
The value that text should end with.
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
true if the given text ends with the value.
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "hash"></a>
|
|
<strong>hash (value)</strong>
|
|
</dt>
|
|
<dd>
|
|
Creates a simple hash in the range of mathutil.SIGNED_32BIT_MIN and
|
|
mathutil.SIGNED_32BIT_MAX (which is roughly -2 billion to 2 billion).
|
|
Note that this is not the best string hash function there could be, but is
|
|
more than sufficient if all you want is to test a string if it is different
|
|
or if you want to create a number from a string of unknown length.
|
|
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">value</span>
|
|
The string value to hash.
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
The hash. Always 0 if the given string is nil or empty.
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "split"></a>
|
|
<strong>split (text, split, trim_values)</strong>
|
|
</dt>
|
|
<dd>
|
|
Splits the given text using the given split value. Returns the splitted text
|
|
as List. If the string is empty or nil, the returned list will not contain
|
|
any entries. If the string only contains a value without a separator,
|
|
the list will contain one value, if it contains only the separator,
|
|
two empty values.
|
|
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">text</span>
|
|
The text to split.
|
|
</li>
|
|
<li><span class="parameter">split</span>
|
|
The split value.
|
|
</li>
|
|
<li><span class="parameter">trim_values</span>
|
|
Optional. If the values should be trimmed, defaults to
|
|
true.
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
The list of splitted values.
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "startswith"></a>
|
|
<strong>startswith (text, value)</strong>
|
|
</dt>
|
|
<dd>
|
|
Tests if the given text starts with the given value.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">text</span>
|
|
The text to check if it starts with the given value.
|
|
</li>
|
|
<li><span class="parameter">value</span>
|
|
The value that text should start with.
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
true if the given text starts with the value.
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "trim"></a>
|
|
<strong>trim (text)</strong>
|
|
</dt>
|
|
<dd>
|
|
Trims the given text from any leading and trailing whitespace.
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">text</span>
|
|
The text to trim.
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
The trimmed text.
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
</div> <!-- id="content" -->
|
|
</div> <!-- id="main" -->
|
|
<div id="about">
|
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.2</a></i>
|
|
</div> <!-- id="about" -->
|
|
</div> <!-- id="container" -->
|
|
</body>
|
|
</html>
|