2021-03-07 05:58:59 +01:00

85 lines
17 KiB
HTML

<!DOCTYPE html>
<html lang="en"><!-- use theme color or fallback -->
<!--use textcolor from settings, otherwise create a contrasting color to theme color-->
<head><meta charset="utf-8"/><link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet"/><link href="./bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet"/><link href="./bootstrap/css/bootstrap-select.min.css" rel="stylesheet"/><link href="http://fonts.googleapis.com/css?family=Open+Sans:400,700,700italic,400italic" rel="stylesheet" type="text/css"/><link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,600,600italic,400" rel="stylesheet" type="text/css"/><link href="http://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css" rel="stylesheet" type="text/css"/><script src="./jquery-1.9.1.min.js"></script><script src="./bootstrap/js/bootstrap.min.js"></script><script src="./bootstrap/js/bootstrap-select.min.js"></script><link href="./styles.css" rel="stylesheet"/><link href="./haxe-nav.css" rel="stylesheet"/><script type="text/javascript">var dox = {rootPath: "./",platforms: ["Neko","Android","Flash","iOS","macOS","Linux","HTML5","Windows"]};</script><script type="text/javascript" src="./nav.js"></script><script type="text/javascript" src="./index.js"></script><link rel="icon" href="./favicon.ico" type="image/x-icon"></link><title>StringTools - API Reference</title><meta name="description" content="This class provides advanced methods on Strings. It is ideally used with
&lt;code&gt;using &lt;a href="./StringTools.html"&gt;StringTools&lt;/a&gt;&lt;/code&gt; and then acts as an &lt;a href="https://haxe.org/manual/lf-static-extension.html"&gt;extension&lt;/a&gt;
to the &lt;code&gt;&lt;a href="./String.html"&gt;String&lt;/a&gt;&lt;/code&gt; class."/></head><body><style>
a, code .type {
color: #24afc4;
}
.navbar .brand {
display: inline-block;
float: none;
text-shadow: 0 0 0 transparent;
}
.nav-list>.active>a.treeLink, .nav-list>.active>a.treeLink:hover, .nav-list>.active>a.treeLink:focus {
background: #24afc4;
color: #ffffff;
text-shadow: 0 0 0 transparent;
}
.navbar .container {
width: 940px ;
}
@media (max-width: 767px) {
.navbar .container {
width: auto;
}
}
@media (max-width: 979px) and (min-width: 768px) {
.navbar .container {
width: 724px;
}
}
@media (min-width: 1200px) {
.navbar .container {
width: 1170px;
}
}
.navbar .container img {
margin: 5px 0 0 4px;
}
</style><nav class="nav"><div class="navbar"><div class="navbar-inner" style="background:#FAFAFA; border-bottom:1px solid rgba(0,0,0,.09)"><div class="container"><a class="brand" href="http://www.openfl.org"><img alt="" src="http://www.openfl.org/images/logo.png"/></a><a class="brand" style="color:#777777" href="./">API Reference</a></div></div></div></nav><div class="container main-content"><div class="row-fluid"><div class="span3"><div class="well sidebar-nav"><form class="form-search" id="searchForm"><div class="input-prepend input-block-level"><span class="add-on"><i class="icon-search"></i></span><input id="search" type="text" placeholder="Search" autocomplete="off"/></div></form><div class="dropdown"><select id="select-platform" class="selectpicker" title="Filter by platform" data-width="100%"><option value="all" selected="true">All Platforms</option><option>Neko</option><option>Android</option><option>Flash</option><option>iOS</option><option>macOS</option><option>Linux</option><option>HTML5</option><option>Windows</option></select></div></div><div class="well sidebar-nav"><div id="nav"></div></div></div><div class="span9"><div class="page-header"><h1><small>class</small> StringTools</h1><h4><small><a href="./">no package</a></small></h4> <p class="availability"><hr/><em>Available on all platforms</em></p></div><div class="body"><div class="doc doc-main"><div class="indent"><p>This class provides advanced methods on Strings. It is ideally used with
<code>using <a href="./StringTools.html">StringTools</a></code> and then acts as an <a href="https://haxe.org/manual/lf-static-extension.html">extension</a>
to the <code><a href="./String.html">String</a></code> class.</p>
<p>If the first argument to any of the methods is null, the result is
unspecified.</p></div></div><h3 class="section">Static variables</h3><div class="fields"><div class="field "><a name="winMetaCharacters"></a><h3><p><code><span class="label">static</span><a href="./StringTools.html#winMetaCharacters"><span class="identifier">winMetaCharacters</span></a>:<a class="type" title="An Array is a storage for values." href="./Array.html">Array</a>&lt;<a class="type" title="The standard Int type." href="./Int.html">Int</a>&gt;<span> = [" ".code, "(".code, ")".code, "%".code, "!".code, "^".code, "\"".code, "&lt;".code, "&gt;".code, "&amp;".code, "|".code, "\n".code, "\r".code, ",".code, ";".code]</span></code></p></h3><p class="availability"><em>Available on Neko, macOS, Linux, Windows</em></p><div class="doc"><p>Character codes of the characters that will be escaped by <code>quoteWinArg(_, true)</code>.</p></div></div></div><h3 class="section">Static methods</h3><div class="fields"><div class="field "><a name="endsWith"></a><h3><p><code><span class="label">static</span><a href="#endsWith"><span class="identifier">endsWith</span></a> (<span style="white-space:nowrap">s:<a class="type" title="The basic String class." href="./String.html">String</a>,</span> <span style="white-space:nowrap">end:<a class="type" title="The basic String class." href="./String.html">String</a></span>):<a class="type" title="The standard Boolean type, which can either be true or false." href="./Bool.html">Bool</a></code></p></h3><div class="doc"><p>Tells if the string <code>s</code> ends with the string <code>end</code>.</p>
<p>If <code>end</code> is <code>null</code>, the result is unspecified.</p>
<p>If <code>end</code> is the empty String <code>""</code>, the result is true.</p></div></div><div class="field "><a name="hex"></a><h3><p><code><span class="label">static</span><a href="#hex"><span class="identifier">hex</span></a> (<span style="white-space:nowrap">n:<a class="type" title="The standard Int type." href="./Int.html">Int</a>,</span> <span style="white-space:nowrap">?digits:<a class="type" title="The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="The basic String class." href="./String.html">String</a></code></p></h3><div class="doc"><p>Encodes <code>n</code> into a hexadecimal representation.</p>
<p>If <code>digits</code> is specified, the resulting String is padded with "0" until
its <code>length</code> equals <code>digits</code>.</p></div></div><div class="field "><a name="htmlEscape"></a><h3><p><code><span class="label">static</span><a href="#htmlEscape"><span class="identifier">htmlEscape</span></a> (<span style="white-space:nowrap">s:<a class="type" title="The basic String class." href="./String.html">String</a>,</span> <span style="white-space:nowrap">?quotes:<a class="type" title="The standard Boolean type, which can either be true or false." href="./Bool.html">Bool</a></span>):<a class="type" title="The basic String class." href="./String.html">String</a></code></p></h3><p class="availability"><em>Available on Neko, macOS, Linux, HTML5, Windows</em></p><div class="doc"><p>Escapes HTML special characters of the string <code>s</code>.</p>
<p>The following replacements are made:</p><ul><li><code>&amp;</code> becomes <code>&amp;amp</code>;</li><li><code>&lt;</code> becomes <code>&amp;lt</code>;</li><li><code>&gt;</code> becomes <code>&amp;gt</code>;</li></ul>
<p>If <code>quotes</code> is true, the following characters are also replaced:</p><ul><li><code>"</code> becomes <code>&amp;quot</code>;</li><li><code>'</code> becomes <code>&amp;#039</code>;</li></ul></div></div><div class="field "><a name="isSpace"></a><h3><p><code><span class="label">static</span><a href="#isSpace"><span class="identifier">isSpace</span></a> (<span style="white-space:nowrap">s:<a class="type" title="The basic String class." href="./String.html">String</a>,</span> <span style="white-space:nowrap">pos:<a class="type" title="The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="The standard Boolean type, which can either be true or false." href="./Bool.html">Bool</a></code></p></h3><p class="availability"><em>Available on Neko, macOS, Linux, HTML5, Windows</em></p><div class="doc"><p>Tells if the character in the string <code>s</code> at position <code>pos</code> is a space.</p>
<p>A character is considered to be a space character if its character code
is 9,10,11,12,13 or 32.</p>
<p>If <code>s</code> is the empty String <code>""</code>, or if pos is not a valid position within
<code>s</code>, the result is false.</p></div></div><div class="field "><a name="lpad"></a><h3><p><code><span class="label">static</span><a href="#lpad"><span class="identifier">lpad</span></a> (<span style="white-space:nowrap">s:<a class="type" title="The basic String class." href="./String.html">String</a>,</span> <span style="white-space:nowrap">c:<a class="type" title="The basic String class." href="./String.html">String</a>,</span> <span style="white-space:nowrap">l:<a class="type" title="The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="The basic String class." href="./String.html">String</a></code></p></h3><p class="availability"><em>Available on Neko, Android, iOS, macOS, Linux, Windows</em></p><div class="doc"><p>Concatenates <code>c</code> to <code>s</code> until <code>s.length</code> is at least <code>l</code>.</p>
<p>If <code>c</code> is the empty String <code>""</code> or if <code>l</code> does not exceed <code>s.length</code>,
<code>s</code> is returned unchanged.</p>
<p>If <code>c.length</code> is 1, the resulting String length is exactly <code>l</code>.</p>
<p>Otherwise the length may exceed <code>l</code>.</p>
<p>If <code>c</code> is null, the result is unspecified.</p></div></div><div class="field "><a name="ltrim"></a><h3><p><code><span class="label">static</span><a href="#ltrim"><span class="identifier">ltrim</span></a> (<span style="white-space:nowrap">s:<a class="type" title="The basic String class." href="./String.html">String</a></span>):<a class="type" title="The basic String class." href="./String.html">String</a></code></p></h3><p class="availability"><em>Available on Neko, macOS, Linux, HTML5, Windows</em></p><div class="doc"><p>Removes leading space characters of <code>s</code>.</p>
<p>This function internally calls <code>isSpace()</code> to decide which characters to
remove.</p>
<p>If <code>s</code> is the empty String <code>""</code> or consists only of space characters, the
result is the empty String <code>""</code>.</p></div></div><div class="field "><a name="quoteUnixArg"></a><h3><p><code><span class="label">static</span><a href="#quoteUnixArg"><span class="identifier">quoteUnixArg</span></a> (<span style="white-space:nowrap">argument:<a class="type" title="The basic String class." href="./String.html">String</a></span>):<a class="type" title="The basic String class." href="./String.html">String</a></code></p></h3><p class="availability"><em>Available on Neko, macOS, Linux, Windows</em></p><div class="doc"><p>Returns a String that can be used as a single command line argument
on Unix.
The input will be quoted, or escaped if necessary.</p></div></div><div class="field "><a name="quoteWinArg"></a><h3><p><code><span class="label">static</span><a href="#quoteWinArg"><span class="identifier">quoteWinArg</span></a> (<span style="white-space:nowrap">argument:<a class="type" title="The basic String class." href="./String.html">String</a>,</span> <span style="white-space:nowrap">escapeMetaCharacters:<a class="type" title="The standard Boolean type, which can either be true or false." href="./Bool.html">Bool</a></span>):<a class="type" title="The basic String class." href="./String.html">String</a></code></p></h3><p class="availability"><em>Available on Neko, macOS, Linux, Windows</em></p><div class="doc"><p>Returns a String that can be used as a single command line argument
on Windows.
The input will be quoted, or escaped if necessary, such that the output
will be parsed as a single argument using the rule specified in
http://msdn.microsoft.com/en-us/library/ms880421</p>
<p>Examples:</p>
<pre><code>quoteWinArg("abc") == "abc";
quoteWinArg("ab c") == '"ab c"';</code></pre></div></div><div class="field "><a name="replace"></a><h3><p><code><span class="label">static</span><a href="#replace"><span class="identifier">replace</span></a> (<span style="white-space:nowrap">s:<a class="type" title="The basic String class." href="./String.html">String</a>,</span> <span style="white-space:nowrap">sub:<a class="type" title="The basic String class." href="./String.html">String</a>,</span> <span style="white-space:nowrap">by:<a class="type" title="The basic String class." href="./String.html">String</a></span>):<a class="type" title="The basic String class." href="./String.html">String</a></code></p></h3><div class="doc"><p>Replace all occurrences of the String <code>sub</code> in the String <code>s</code> by the
String <code>by</code>.</p>
<p>If <code>sub</code> is the empty String <code>""</code>, <code>by</code> is inserted after each character
of <code>s</code>. If <code>by</code> is also the empty String <code>""</code>, <code>s</code> remains unchanged.</p>
<p>This is a convenience function for <code>s.split(sub).join(by)</code>.</p>
<p>If <code>sub</code> or <code>by</code> are null, the result is unspecified.</p></div></div><div class="field "><a name="rtrim"></a><h3><p><code><span class="label">static</span><a href="#rtrim"><span class="identifier">rtrim</span></a> (<span style="white-space:nowrap">s:<a class="type" title="The basic String class." href="./String.html">String</a></span>):<a class="type" title="The basic String class." href="./String.html">String</a></code></p></h3><p class="availability"><em>Available on Neko, macOS, Linux, HTML5, Windows</em></p><div class="doc"><p>Removes trailing space characters of <code>s</code>.</p>
<p>This function internally calls <code>isSpace()</code> to decide which characters to
remove.</p>
<p>If <code>s</code> is the empty String <code>""</code> or consists only of space characters, the
result is the empty String <code>""</code>.</p></div></div><div class="field "><a name="startsWith"></a><h3><p><code><span class="label">static</span><a href="#startsWith"><span class="identifier">startsWith</span></a> (<span style="white-space:nowrap">s:<a class="type" title="The basic String class." href="./String.html">String</a>,</span> <span style="white-space:nowrap">start:<a class="type" title="The basic String class." href="./String.html">String</a></span>):<a class="type" title="The standard Boolean type, which can either be true or false." href="./Bool.html">Bool</a></code></p></h3><div class="doc"><p>Tells if the string <code>s</code> starts with the string <code>start</code>.</p>
<p>If <code>start</code> is <code>null</code>, the result is unspecified.</p>
<p>If <code>start</code> is the empty String <code>""</code>, the result is true.</p></div></div><div class="field "><a name="trim"></a><h3><p><code><span class="label">static</span><a href="#trim"><span class="identifier">trim</span></a> (<span style="white-space:nowrap">s:<a class="type" title="The basic String class." href="./String.html">String</a></span>):<a class="type" title="The basic String class." href="./String.html">String</a></code></p></h3><p class="availability"><em>Available on Neko, macOS, Linux, HTML5, Windows</em></p><div class="doc"><p>Removes leading and trailing space characters of <code>s</code>.</p>
<p>This is a convenience function for <code>ltrim(rtrim(s))</code>.</p></div></div><div class="field "><a name="urlDecode"></a><h3><p><code><span class="label">static</span><a href="#urlDecode"><span class="identifier">urlDecode</span></a> (<span style="white-space:nowrap">s:<a class="type" title="The basic String class." href="./String.html">String</a></span>):<a class="type" title="The basic String class." href="./String.html">String</a></code></p></h3><p class="availability"><em>Available on Android, iOS, macOS, Linux, Windows</em></p><div class="doc"><p>Decode an URL using the standard format.</p></div></div><div class="field "><a name="urlEncode"></a><h3><p><code><span class="label">static</span><a href="#urlEncode"><span class="identifier">urlEncode</span></a> (<span style="white-space:nowrap">s:<a class="type" title="The basic String class." href="./String.html">String</a></span>):<a class="type" title="The basic String class." href="./String.html">String</a></code></p></h3><p class="availability"><em>Available on Android, iOS, macOS, Linux, Windows</em></p><div class="doc"><p>Encode an URL by using the standard format.</p></div></div></div></div></div></div></div><footer class="section site-footer" style="background:#FAFAFA"><div class="container"><div class="copyright"><p style="color:#777777">&copy; 2017 &nbsp;<a style="color:#777777" href="http://www.openfl.org">http://www.openfl.org</a></p></div></div></footer><script src=".//highlighter.js"></script><link href="./highlighter.css" rel="stylesheet"/></body></html>