flavor-js
Version:
FlavorJS the definitive JS natives chainable extensions methods (based on lodash & ES6)
3,035 lines (825 loc) • 79.4 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>string - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="FlavorJS.html">FlavorJS</a><ul class='methods'><li data-type='method'><a href="FlavorJS.html#delay">delay</a></li><li data-type='method'><a href="FlavorJS.html#extendArray">extendArray</a></li><li data-type='method'><a href="FlavorJS.html#extendBoolean">extendBoolean</a></li><li data-type='method'><a href="FlavorJS.html#extendDate">extendDate</a></li><li data-type='method'><a href="FlavorJS.html#extendFunction">extendFunction</a></li><li data-type='method'><a href="FlavorJS.html#extendLodash">extendLodash</a></li><li data-type='method'><a href="FlavorJS.html#extendNumber">extendNumber</a></li><li data-type='method'><a href="FlavorJS.html#extendObject">extendObject</a></li><li data-type='method'><a href="FlavorJS.html#extendPrototype">extendPrototype</a></li><li data-type='method'><a href="FlavorJS.html#extendPrototypeProperty">extendPrototypeProperty</a></li><li data-type='method'><a href="FlavorJS.html#extendString">extendString</a></li><li data-type='method'><a href="FlavorJS.html#init">init</a></li></ul></li></ul><h3>Namespaces</h3><ul><li><a href="array.html">array</a><ul class='methods'><li data-type='method'><a href="array.html#clone">clone</a></li><li data-type='method'><a href="array.html#concat">concat</a></li><li data-type='method'><a href="array.html#contains">contains</a></li><li data-type='method'><a href="array.html#containsBy">containsBy</a></li><li data-type='method'><a href="array.html#countBy">countBy</a></li><li data-type='method'><a href="array.html#cut">cut</a></li><li data-type='method'><a href="array.html#deepFindBy">deepFindBy</a></li><li data-type='method'><a href="array.html#deepMap">deepMap</a></li><li data-type='method'><a href="array.html#deepSortBy">deepSortBy</a></li><li data-type='method'><a href="array.html#diff">diff</a></li><li data-type='method'><a href="array.html#diffBy">diffBy</a></li><li data-type='method'><a href="array.html#distinct">distinct</a></li><li data-type='method'><a href="array.html#each">each</a></li><li data-type='method'><a href="array.html#filterBy">filterBy</a></li><li data-type='method'><a href="array.html#findBy">findBy</a></li><li data-type='method'><a href="array.html#first">first</a></li><li data-type='method'><a href="array.html#flatten">flatten</a></li><li data-type='method'><a href="array.html#indexBy">indexBy</a></li><li data-type='method'><a href="array.html#intersection">intersection</a></li><li data-type='method'><a href="array.html#isArray">isArray</a></li><li data-type='method'><a href="array.html#last">last</a></li><li data-type='method'><a href="array.html#lorem">lorem</a></li><li data-type='method'><a href="array.html#maxBy">maxBy</a></li><li data-type='method'><a href="array.html#pull">pull</a></li><li data-type='method'><a href="array.html#pullBy">pullBy</a></li><li data-type='method'><a href="array.html#random">random</a></li><li data-type='method'><a href="array.html#removeBy">removeBy</a></li><li data-type='method'><a href="array.html#shuffle">shuffle</a></li><li data-type='method'><a href="array.html#sortBy">sortBy</a></li><li data-type='method'><a href="array.html#split">split</a></li><li data-type='method'><a href="array.html#sum">sum</a></li><li data-type='method'><a href="array.html#tail">tail</a></li><li data-type='method'><a href="array.html#tail">tail</a></li><li data-type='method'><a href="array.html#union">union</a></li></ul></li><li><a href="boolean.html">boolean</a><ul class='methods'><li data-type='method'><a href="boolean.html#isBoolean">isBoolean</a></li><li data-type='method'><a href="boolean.html#random">random</a></li></ul></li><li><a href="date.html">date</a><ul class='methods'><li data-type='method'><a href="date.html#isDate">isDate</a></li><li data-type='method'><a href="date.html#random">random</a></li><li data-type='method'><a href="date.html#toTimestamp">toTimestamp</a></li></ul></li><li><a href="function.html">function</a><ul class='methods'><li data-type='method'><a href="function.html#isFunction">isFunction</a></li><li data-type='method'><a href="function.html#proxy">proxy</a></li></ul></li><li><a href="lodash.html">lodash</a><ul class='methods'><li data-type='method'><a href="lodash.html#deepFindBy">deepFindBy</a></li><li data-type='method'><a href="lodash.html#deepMap">deepMap</a></li><li data-type='method'><a href="lodash.html#deepOrderBy">deepOrderBy</a></li><li data-type='method'><a href="lodash.html#filterByValues">filterByValues</a></li><li data-type='method'><a href="lodash.html#isPercentage">isPercentage</a></li><li data-type='method'><a href="lodash.html#parsePercentage">parsePercentage</a></li><li data-type='method'><a href="lodash.html#pullAllByComparator">pullAllByComparator</a></li><li data-type='method'><a href="lodash.html#timesRange">timesRange</a></li><li data-type='method'><a href="lodash.html#timesReverse">timesReverse</a></li></ul></li><li><a href="number.html">number</a><ul class='methods'><li data-type='method'><a href="number.html#between">between</a></li><li data-type='method'><a href="number.html#degreeDiff">degreeDiff</a></li><li data-type='method'><a href="number.html#degreeDir">degreeDir</a></li><li data-type='method'><a href="number.html#degreeWrap">degreeWrap</a></li><li data-type='method'><a href="number.html#floor">floor</a></li><li data-type='method'><a href="number.html#fromRoman">fromRoman</a></li><li data-type='method'><a href="number.html#isNumber">isNumber</a></li><li data-type='method'><a href="number.html#parse">parse</a></li><li data-type='method'><a href="number.html#random">random</a></li><li data-type='method'><a href="number.html#range">range</a></li><li data-type='method'><a href="number.html#round">round</a></li><li data-type='method'><a href="number.html#round">round</a></li><li data-type='method'><a href="number.html#times">times</a></li><li data-type='method'><a href="number.html#toAbsolute">toAbsolute</a></li><li data-type='method'><a href="number.html#toCurrency">toCurrency</a></li><li data-type='method'><a href="number.html#toFileSize">toFileSize</a></li><li data-type='method'><a href="number.html#toRoman">toRoman</a></li><li data-type='method'><a href="number.html#toSymbolString">toSymbolString</a></li></ul></li><li><a href="object.html">object</a><ul class='methods'><li data-type='method'><a href="object.html#clone">clone</a></li><li data-type='method'><a href="object.html#each">each</a></li><li data-type='method'><a href="object.html#inherit">inherit</a></li><li data-type='method'><a href="object.html#isObject">isObject</a></li><li data-type='method'><a href="object.html#omit">omit</a></li><li data-type='method'><a href="object.html#path">path</a></li><li data-type='method'><a href="object.html#pick">pick</a></li></ul></li><li><a href="string.html">string</a><ul class='methods'><li data-type='method'><a href="string.html#camelCase">camelCase</a></li><li data-type='method'><a href="string.html#capitalize">capitalize</a></li><li data-type='method'><a href="string.html#contains">contains</a></li><li data-type='method'><a href="string.html#decodeURI">decodeURI</a></li><li data-type='method'><a href="string.html#encodeURI">encodeURI</a></li><li data-type='method'><a href="string.html#endsWith">endsWith</a></li><li data-type='method'><a href="string.html#escapeHTML">escapeHTML</a></li><li data-type='method'><a href="string.html#escapeHTML">escapeHTML</a></li><li data-type='method'><a href="string.html#extractDomain">extractDomain</a></li><li data-type='method'><a href="string.html#extractFileExtension">extractFileExtension</a></li><li data-type='method'><a href="string.html#extractQueryString">extractQueryString</a></li><li data-type='method'><a href="string.html#guid">guid</a></li><li data-type='method'><a href="string.html#isRoman">isRoman</a></li><li data-type='method'><a href="string.html#isString">isString</a></li><li data-type='method'><a href="string.html#isUrl">isUrl</a></li><li data-type='method'><a href="string.html#pad">pad</a></li><li data-type='method'><a href="string.html#padLeft">padLeft</a></li><li data-type='method'><a href="string.html#padRight">padRight</a></li><li data-type='method'><a href="string.html#parsePercentage">parsePercentage</a></li><li data-type='method'><a href="string.html#parsePercentage">parsePercentage</a></li><li data-type='method'><a href="string.html#replaceAll">replaceAll</a></li><li data-type='method'><a href="string.html#slugify">slugify</a></li><li data-type='method'><a href="string.html#startsWith">startsWith</a></li><li data-type='method'><a href="string.html#stripTags">stripTags</a></li><li data-type='method'><a href="string.html#toArray">toArray</a></li><li data-type='method'><a href="string.html#toInt">toInt</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<div id="main">
<h1 class="page-title">string</h1>
<section>
<header>
<h2>
string
</h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line3">line 3</a>
</li></ul></dd>
</dl>
<div class="description">the JS native String class</div>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="camelCase"><span class="type-signature"></span>camelCase<span class="signature">(s)</span><span class="type-signature"> → {<a href="string.html">string</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line194">line 194</a>
</li></ul></dd>
</dl>
<div class="description">
camel cases a string
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.camelCase('Foo Bar')); // 'fooBar'
console.log(String.camelCase('--foo-bar--')); // 'fooBar'
console.log(String.camelCase('__FOO_BAR__')); // 'fooBar'
console.log('Foo Bar'.camelCase()); // 'fooBar'
console.log('--foo-bar--'.camelCase()); // 'fooBar'
console.log('__FOO_BAR__'.camelCase()); // 'fooBar'</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="description last">the string</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="string.html">string</a></span>
</dd>
</dl>
<h4 class="name" id="capitalize"><span class="type-signature"></span>capitalize<span class="signature">(s)</span><span class="type-signature"> → {<a href="string.html">string</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line218">line 218</a>
</li></ul></dd>
</dl>
<div class="description">
capitalizes a string
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.capitalize('we\'re happy to use flavorJS')); // Were Happy To Use Flavor JS
console.log(String.capitalize('we\'re happy to use flavorJS')); // We're happy to use flavorjs
console.log(String.capitalize('flavorJS')); // Flavorjs</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="string.html">string</a></span>
</dd>
</dl>
<h4 class="name" id="contains"><span class="type-signature"></span>contains<span class="signature">(s, value, insensitive<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="boolean.html">boolean</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line85">line 85</a>
</li></ul></dd>
</dl>
<div class="description">
checks if a string contains another string
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.contains('FlavorJS is tasty', 'JS is')); // true
console.log(String.contains('FlavorJS is tasty', 'js is')); // false
console.log(String.contains('FlavorJS is tasty', 'js is', true)); // true
console.log(String.contains('flavorJS Is tasty', 'JS is', true)); // true
console.log('FlavorJS is tasty'.contains('JS is')); // true
console.log('FlavorJS is tasty'.contains('js is')); // false
console.log('FlavorJS is tasty'.contains('js is', true)); // true
console.log('flavorJS is tasty'.contains('JS is', true)); // true</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">the string to be checked</td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">the string value to check</td>
</tr>
<tr>
<td class="name"><code>insensitive</code></td>
<td class="type">
<span class="param-type"><a href="boolean.html">boolean</a></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>false</code>
</td>
<td class="description last">true if you want to do an insensitive check</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="boolean.html">boolean</a></span>
</dd>
</dl>
<h4 class="name" id="decodeURI"><span class="type-signature"></span>decodeURI<span class="signature">(s)</span><span class="type-signature"> → {<a href="string.html">string</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line236">line 236</a>
</li></ul></dd>
</dl>
<div class="description">
decodes an URI string
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.decodeURI('https%3A%2F%2Fflavorjs.io%2Fpage.html%3Fname%3Dblack%20mirror%26email%3Dusername%40example.com')); // 'https://flavorjs.io/page.html?name=black mirror&email=username@example.com'
console.log(('https%3A%2F%2Fflavorjs.io%2Fpage.html%3Fname%3Dblack%20mirror%26email%3Dusername%40example.com').decodeURI()); // 'https://flavorjs.io/page.html?name=black mirror&email=username@example.com'</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="description last">the URI string</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="string.html">string</a></span>
</dd>
</dl>
<h4 class="name" id="encodeURI"><span class="type-signature"></span>encodeURI<span class="signature">(s)</span><span class="type-signature"> → {<a href="string.html">string</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line252">line 252</a>
</li></ul></dd>
</dl>
<div class="description">
encodes an URI string
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.encodeURI('https://flavorjs.io/page.html?name=black mirror&email=username@example.com')); // 'https%3A%2F%2Fflavorjs.io%2Fpage.html%3Fname%3Dblack%20mirror%26email%3Dusername%40example.com'
console.log(('https://flavorjs.io/page.html?name=black mirror&email=username@example.com').encodeURI()); // 'https%3A%2F%2Fflavorjs.io%2Fpage.html%3Fname%3Dblack%20mirror%26email%3Dusername%40example.com'</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="description last">the URI string</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="string.html">string</a></span>
</dd>
</dl>
<h4 class="name" id="endsWith"><span class="type-signature"></span>endsWith<span class="signature">(s, value, insensitive<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {<a href="boolean.html">boolean</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line145">line 145</a>
</li></ul></dd>
</dl>
<div class="description">
checks if a string ends with another string
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.endsWith('FlavorJS is tasty', 'Tasty')); // false
console.log(String.endsWith('FlavorJS is tasty', 'tasty')); // true
console.log(String.endsWith('FlavorJS is tasty', 'Tasty', true)); // true
console.log(String.endsWith('FlavorJS is Tasty', 'tasty', true)); // true
console.log(('FlavorJS is tasty').endsWith('Tasty')); // false
console.log(('FlavorJS is tasty').endsWith('tasty')); // true
console.log(('FlavorJS is tasty').endsWith('Tasty', true)); // true
console.log(('flavorJS is Tasty').endsWith('tasty', true)); // true</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">the string to be checked</td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">the value to check</td>
</tr>
<tr>
<td class="name"><code>insensitive</code></td>
<td class="type">
<span class="param-type"><a href="boolean.html">boolean</a></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
<code>false</code>
</td>
<td class="description last">true if you want to do an insensitive check</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="boolean.html">boolean</a></span>
</dd>
</dl>
<h4 class="name" id="escapeHTML"><span class="type-signature"></span>escapeHTML<span class="signature">(s)</span><span class="type-signature"> → {<a href="string.html">string</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line501">line 501</a>
</li></ul></dd>
</dl>
<div class="description">
unescapes an HTML code string
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.unescapeHTML('&lt;div&gt;flavor &amp; js = tasty&lt;/div&gt;')); // '<div>flavor & js = tasty</div>'
console.log(('&lt;div&gt;flavor &amp; js = tasty&lt;/div&gt;').unescapeHTML()); // '<div>flavor & js = tasty</div>'</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="description last">the HTML code string</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="string.html">string</a></span>
</dd>
</dl>
<h4 class="name" id="escapeHTML"><span class="type-signature"></span>escapeHTML<span class="signature">(s)</span><span class="type-signature"> → {<a href="string.html">string</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line268">line 268</a>
</li></ul></dd>
</dl>
<div class="description">
escapes an HTML code string
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.escapeHTML('<div>flavor & js = tasty</div>')); // '&lt;div&gt;flavor &amp; js = tasty&lt;/div&gt;'
console.log(('<div>flavor & js = tasty</div>').escapeHTML()); // '&lt;div&gt;flavor &amp; js = tasty&lt;/div&gt;'</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="description last">the HTML code string</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="string.html">string</a></span>
</dd>
</dl>
<h4 class="name" id="extractDomain"><span class="type-signature"></span>extractDomain<span class="signature">(s, level, excludeWww)</span><span class="type-signature"> → {*}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line284">line 284</a>
</li></ul></dd>
</dl>
<div class="description">
extracts a domain from an URI string with level parameter
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.extractDomain('http://www.google.com')); // google.com
console.log(String.extractDomain('http://www.google.com', )); // google.com</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="description last">the URI string</td>
</tr>
<tr>
<td class="name"><code>level</code></td>
<td class="type">
<span class="param-type"><a href="number.html">number</a></span>
</td>
<td class="description last">the domain level to extract, starting from right obviously</td>
</tr>
<tr>
<td class="name"><code>excludeWww</code></td>
<td class="type">
<span class="param-type"><a href="boolean.html">boolean</a></span>
</td>
<td class="description last">true if you want to exclude the www. from che extraction</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id="extractFileExtension"><span class="type-signature"></span>extractFileExtension<span class="signature">(s)</span><span class="type-signature"> → {*}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line302">line 302</a>
</li></ul></dd>
</dl>
<div class="description">
extracts the file extension from a filename/path string
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.extractFileExtension('file.jpg')); // 'jpg'
console.log(String.extractFileExtension('file')); // ''
console.log(String.extractFileExtension(1)); // 1
console.log(('file.jpg').extractFileExtension()); // 'jpg'
console.log(('file').extractFileExtension()); // ''
console.log((1).extractFileExtension()); // throws error</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id="extractQueryString"><span class="type-signature"></span>extractQueryString<span class="signature">(s)</span><span class="type-signature"> → {<a href="object.html">object</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line330">line 330</a>
</li></ul></dd>
</dl>
<div class="description">
extracts the query string object from an URI string
</div>
<h5>Examples</h5>
<pre class="prettyprint"><code><caption>eg. usage</caption></code></pre>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.extractQueryString('https://flavorjs.io/page.html?name=black mirror&email=username@example.com')); // {name: 'black mirror', email: 'username@example.com'}
console.log(('https://flavorjs.io/page.html?name=black mirror&email=username@example.com').extractQueryString()); // {name: 'black mirror', email: 'username@example.com'}</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="description last">the URI string</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="object.html">object</a></span>
</dd>
</dl>
<h4 class="name" id="guid"><span class="type-signature"></span>guid<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line175">line 175</a>
</li></ul></dd>
</dl>
<div class="description">
stubs a GUID
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.guid()); // 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'</code></pre>
<h4 class="name" id="isRoman"><span class="type-signature"></span>isRoman<span class="signature">(s)</span><span class="type-signature"> → {<a href="boolean.html">boolean</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line49">line 49</a>
</li></ul></dd>
</dl>
<div class="description">
checks if a string is a roman number string
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.isRoman('MCMLXXX')); // true
console.log(String.isRoman('50,25')); // false
console.log(String.isRoman(5)); // false</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="description last">the string to be checked</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="boolean.html">boolean</a></span>
</dd>
</dl>
<h4 class="name" id="isString"><span class="type-signature"></span>isString<span class="signature">(s)</span><span class="type-signature"> → {<a href="boolean.html">boolean</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line9">line 9</a>
</li></ul></dd>
</dl>
<div class="description">
checks if something is a string
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>var s = 'foo';
console.log(String.isString(s)); // true
console.log(String.isString(2)); // false
console.log(String.isString('')); // true
console.log(String.isString(null)); // false</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="description last">the string to be checked</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="boolean.html">boolean</a></span>
</dd>
</dl>
<h4 class="name" id="isUrl"><span class="type-signature"></span>isUrl<span class="signature">(s)</span><span class="type-signature"> → {*|<a href="boolean.html">boolean</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line67">line 67</a>
</li></ul></dd>
</dl>
<div class="description">
checks if a string is an url string (URI)
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.isUrl('http://www.google.it')); // true
console.log(String.isUrl('50,25')); // false
console.log(String.isUrl(5)); // false</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="description last">the string to check</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
|
<span class="param-type"><a href="boolean.html">boolean</a></span>
</dd>
</dl>
<h4 class="name" id="pad"><span class="type-signature"></span>pad<span class="signature">(s, length, chars)</span><span class="type-signature"> → {<a href="string.html">string</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line347">line 347</a>
</li></ul></dd>
</dl>
<div class="description">
pads string on the left and right sides if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length.
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.pad('5', 5)); // ' 5 '
console.log(String.pad('5', 5, '0')); // '00500'
console.log(String.pad(4, 5, '01')); // '01401'
console.log(String.pad(true, 5, '01')); // '1true'
console.log(String.pad(4, 5, '01')); // '01401'
console.log(String.pad(new Date(), 50, '--') // '-----Tue Apr 04 2017 17:54:40 GMT+0000 (CEST)-----'</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>s</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="description last">the string to be padded</td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type"><a href="number.html">number</a></span>
</td>
<td class="description last">the string length you need</td>
</tr>
<tr>
<td class="name"><code>chars</code></td>
<td class="type">
<span class="param-type"><a href="string.html">string</a></span>
</td>
<td class="description last">the char/chars to be used to pad the string</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="string.html">string</a></span>
</dd>
</dl>
<h4 class="name" id="padLeft"><span class="type-signature"></span>padLeft<span class="signature">(s, length, chars)</span><span class="type-signature"> → {<a href="string.html">string</a>}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Extensions_string.js.html">Extensions/string.js</a>, <a href="Extensions_string.js.html#line373">line 373</a>
</li></ul></dd>
</dl>
<div class="description">
pads left a string
</div>
<h5>Example</h5>
<p class="code-caption">eg. usage</p>
<pre class="prettyprint"><code>console.log(String.padLeft('5', 4)); // ' 5'
console.log(String.padLeft('5', 4, '0')); // '0005'
console.log(String.padLeft('5', 5, '01')); // '01015'
console.log(String.padLeft(5, 4, '0')); // '0005'
console.log(String.padLeft(true, 5, '0')); // '0true'
console.log(String.padLeft(new Date(), 50, '--') // '----------Tue Apr 04 2017 17:54:40 GMT+0000 (CEST)'</code></pre>
<h5>Parameters:</h5>
<table class="params">
<thead>