Browse Source

String

pull/46/head
Jure Šorn 5 years ago
parent
commit
c2abdfc998
3 changed files with 34 additions and 30 deletions
  1. 22
      README.md
  2. 21
      index.html
  3. 21
      web/script_2.js

22
README.md

@ -335,17 +335,17 @@ String
### Property Methods
```text
+---------------+----------+----------+----------+----------+----------+----------+
| | [\t\n\r] | [ !#$%…] | [A-Za-z] | [¼½¾…] | [¹²³…] | [0-9] |
+---------------+----------+----------+----------+----------+----------+----------+
| isprintable() | | yes | yes | yes | yes | yes |
| isalnum() | | | yes | yes | yes | yes |
| isnumeric() | | | | yes | yes | yes |
| isdigit() | | | | | yes | yes |
| isdecimal() | | | | | | yes |
+---------------+----------+----------+----------+----------+----------+----------+
```
+---------------+----------+----------+----------+----------+----------+
| | [ !#$%…] | [a-zA-Z] | [¼½¾…] | [¹²³…] | [0-9] |
+---------------+----------+----------+----------+----------+----------+
| isprintable() | yes | yes | yes | yes | yes |
| isalnum() | | yes | yes | yes | yes |
| isnumeric() | | | yes | yes | yes |
| isdigit() | | | | yes | yes |
| isdecimal() | | | | | yes |
+---------------+----------+----------+----------+----------+----------+
```
* **Also: `'isspace()'` checks for `'[ \t\n\r…]'`.**
Regex
-----

21
index.html

@ -443,17 +443,20 @@ to_exclusive = <range>.stop
<li><strong>Also: <code class="python hljs"><span class="hljs-string">'lstrip()'</span></code>, <code class="python hljs"><span class="hljs-string">'rstrip()'</span></code>.</strong></li>
<li><strong>Also: <code class="python hljs"><span class="hljs-string">'lower()'</span></code>, <code class="python hljs"><span class="hljs-string">'upper()'</span></code>, <code class="python hljs"><span class="hljs-string">'capitalize()'</span></code> and <code class="python hljs"><span class="hljs-string">'title()'</span></code>.</strong></li>
</ul>
<div><h3 id="propertymethods">Property Methods</h3><pre><code class="text language-text">+---------------+----------+----------+----------+----------+----------+----------+
| | [\t\n\r] | [ !#$%…] | [A-Za-z] | [¼½¾…] | [¹²³…] | [0-9] |
+---------------+----------+----------+----------+----------+----------+----------+
| isprintable() | | yes | yes | yes | yes | yes |
| isalnum() | | | yes | yes | yes | yes |
| isnumeric() | | | | yes | yes | yes |
| isdigit() | | | | | yes | yes |
| isdecimal() | | | | | | yes |
+---------------+----------+----------+----------+----------+----------+----------+
<div><h3 id="propertymethods">Property Methods</h3><pre><code class="text language-text">+---------------+----------+----------+----------+----------+----------+
| | [ !#$%…] | [a-zA-Z] | [¼½¾…] | [¹²³…] | [0-9] |
+---------------+----------+----------+----------+----------+----------+
| isprintable() | yes | yes | yes | yes | yes |
| isalnum() | | yes | yes | yes | yes |
| isnumeric() | | | yes | yes | yes |
| isdigit() | | | | yes | yes |
| isdecimal() | | | | | yes |
+---------------+----------+----------+----------+----------+----------+
</code></pre></div>
<ul>
<li><strong>Also: <code class="python hljs"><span class="hljs-string">'isspace()'</span></code> checks for <code class="python hljs"><span class="hljs-string">'[ \t\n\r…]'</span></code>.</strong></li>
</ul>
<div><h2 id="regex"><a href="#regex" name="regex">#</a>Regex</h2><pre><code class="python language-python hljs"><span class="hljs-keyword">import</span> re
&lt;str&gt; = re.sub(&lt;regex&gt;, new, text, count=<span class="hljs-number">0</span>) <span class="hljs-comment"># Substitutes all occurrences.</span>
&lt;list&gt; = re.findall(&lt;regex&gt;, text) <span class="hljs-comment"># Returns all occurrences.</span>

21
web/script_2.js

@ -206,18 +206,19 @@ const DIAGRAM_11_B =
'┗━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━━━━━━━┛\n';
const DIAGRAM_12_A =
'+---------------+----------+----------+----------+----------+----------+----------+\n';
'+---------------+----------+----------+----------+----------+----------+\n';
const DIAGRAM_12_B =
'┏━━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┓\n' +
'┃ │ [\\t\\n\\r] │ [ !#$%…] │ [A-Za-z] │ [¼½¾…] │ [¹²³…] │ [0-9] ┃\n' +
'┠───────────────┼──────────┼──────────┼──────────┼──────────┼──────────┼──────────┨\n' +
'┃ isprintable() │ │ ✓ │ ✓ │ ✓ │ ✓ │ ✓ ┃\n' +
'┃ isalnum() │ │ │ ✓ │ ✓ │ ✓ │ ✓ ┃\n' +
'┃ isnumeric() │ │ │ │ ✓ │ ✓ │ ✓ ┃\n' +
'┃ isdigit() │ │ │ │ │ ✓ │ ✓ ┃\n' +
'┃ isdecimal() │ │ │ │ │ │ ✓ ┃\n' +
'┗━━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┛\n';
'┏━━━━━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━┓\n' +
'┃ │ [ !#$%…] │ [a-zA-Z] │ [¼½¾…] │ [¹²³…] │ [0-9] ┃\n' +
'┠───────────────┼──────────┼──────────┼──────────┼──────────┼──────────┨\n' +
'┃ isprintable() │ ✓ │ ✓ │ ✓ │ ✓ │ ✓ ┃\n' +
'┃ isalnum() │ │ ✓ │ ✓ │ ✓ │ ✓ ┃\n' +
'┃ isnumeric() │ │ │ ✓ │ ✓ │ ✓ ┃\n' +
'┃ isdigit() │ │ │ │ ✓ │ ✓ ┃\n' +
'┃ isdecimal() │ │ │ │ │ ✓ ┃\n' +
'┗━━━━━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━┛\n';
// isFontAvailable:
(function(d){function c(c){b.style.fontFamily=c;e.appendChild(b);f=b.clientWidth;e.removeChild(b);return f}var f,e=d.body,b=d.createElement("span");b.innerHTML=Array(100).join("wi");b.style.cssText=["position:absolute","width:auto","font-size:128px","left:-99999px"].join(" !important;");var g=c("monospace"),h=c("serif"),k=c("sans-serif");window.isFontAvailable=function(b){return g!==c(b+",monospace")||k!==c(b+",sans-serif")||h!==c(b+",serif")}})(document);

Loading…
Cancel
Save