Skip to content

Commit d501423

Browse files
committed
String
1 parent 0ec4301 commit d501423

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,10 +325,15 @@ String
325325
<str> = <str>.translate(<table>) # Use `str.maketrans(<dict>)` to generate table.
326326
<list> = textwrap.wrap(<str>, width) # Nicely breaks string into lines.
327327
```
328+
329+
```python
330+
<str> = chr(<int>) # Converts int to unicode char.
331+
<int> = ord(<str>) # Converts unicode char to int.
332+
```
328333
* **Also: `'lstrip()'`, `'rstrip()'`.**
329334
* **Also: `'lower()'`, `'upper()'`, `'capitalize()'` and `'title()'`.**
330335

331-
### Properties
336+
### Property Methods
332337
```text
333338
+---------------+----------+----------+----------+----------+----------+----------+
334339
| | [\t\n\r] | [ !#$%…] | [A-Za-z] | [¼½¾…] | [¹²³…] | [0-9] |
@@ -341,12 +346,6 @@ String
341346
+---------------+----------+----------+----------+----------+----------+----------+
342347
```
343348

344-
### Char
345-
```python
346-
<str> = chr(<int>) # Converts int to unicode char.
347-
<int> = ord(<str>) # Converts unicode char to int.
348-
```
349-
350349

351350
Regex
352351
-----

index.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,14 @@
436436
&lt;str&gt; = &lt;str&gt;.translate(&lt;table&gt;) <span class="hljs-comment"># Use `str.maketrans(&lt;dict&gt;)` to generate table.</span>
437437
&lt;list&gt; = textwrap.wrap(&lt;str&gt;, width) <span class="hljs-comment"># Nicely breaks string into lines.</span>
438438
</code></pre>
439+
<pre><code class="python language-python hljs">&lt;str&gt; = chr(&lt;int&gt;) <span class="hljs-comment"># Converts int to unicode char.</span>
440+
&lt;int&gt; = ord(&lt;str&gt;) <span class="hljs-comment"># Converts unicode char to int.</span>
441+
</code></pre>
439442
<ul>
440443
<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>
441444
<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>
442445
</ul>
443-
<div><h3 id="properties">Properties</h3><pre><code class="text language-text">+---------------+----------+----------+----------+----------+----------+----------+
446+
<div><h3 id="propertymethods">Property Methods</h3><pre><code class="text language-text">+---------------+----------+----------+----------+----------+----------+----------+
444447
| | [\t\n\r] | [ !#$%…] | [A-Za-z] | [¼½¾…] | [¹²³…] | [0-9] |
445448
+---------------+----------+----------+----------+----------+----------+----------+
446449
| isprintable() | | yes | yes | yes | yes | yes |
@@ -451,10 +454,6 @@
451454
+---------------+----------+----------+----------+----------+----------+----------+
452455
</code></pre></div>
453456

454-
<div><h3 id="char">Char</h3><pre><code class="python language-python hljs">&lt;str&gt; = chr(&lt;int&gt;) <span class="hljs-comment"># Converts int to unicode char.</span>
455-
&lt;int&gt; = ord(&lt;str&gt;) <span class="hljs-comment"># Converts unicode char to int.</span>
456-
</code></pre></div>
457-
458457
<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
459458
&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>
460459
&lt;list&gt; = re.findall(&lt;regex&gt;, text) <span class="hljs-comment"># Returns all occurrences.</span>

0 commit comments

Comments
 (0)