Skip to content

Commit 8ace934

Browse files
committed
String
1 parent 4f38a24 commit 8ace934

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,14 @@ String
320320
<int> = <str>.index(<sub_str>) # Same but raises ValueError if missing.
321321
```
322322

323+
```python
324+
<bool> = <str>.isdecimal() # True if str contains only [0-9], [٠-٩], …
325+
<bool> = <str>.isdigit() # Also true if str contains '¹²³…'.
326+
<bool> = <str>.isnumeric() # Also true if str contains '¼½¾…'.
327+
```
328+
323329
```python
324330
<str> = <str>.replace(old, new [, count]) # Replaces 'old' with 'new' at most 'count' times.
325-
<bool> = <str>.isnumeric() # True if str contains only numeric characters.
326331
<list> = textwrap.wrap(<str>, width) # Nicely breaks string into lines.
327332
```
328333

index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,11 @@
432432
&lt;int&gt; = &lt;str&gt;.find(&lt;sub_str&gt;) <span class="hljs-comment"># Returns start index of first match or -1.</span>
433433
&lt;int&gt; = &lt;str&gt;.index(&lt;sub_str&gt;) <span class="hljs-comment"># Same but raises ValueError if missing.</span>
434434
</code></pre>
435+
<pre><code class="python language-python hljs">&lt;bool&gt; = &lt;str&gt;.isdecimal() <span class="hljs-comment"># True if str contains only [0-9], [٠-٩], …</span>
436+
&lt;bool&gt; = &lt;str&gt;.isdigit() <span class="hljs-comment"># Also true if str contains '¹²³…'.</span>
437+
&lt;bool&gt; = &lt;str&gt;.isnumeric() <span class="hljs-comment"># Also true if str contains '¼½¾…'.</span>
438+
</code></pre>
435439
<pre><code class="python language-python hljs">&lt;str&gt; = &lt;str&gt;.replace(old, new [, count]) <span class="hljs-comment"># Replaces 'old' with 'new' at most 'count' times.</span>
436-
&lt;bool&gt; = &lt;str&gt;.isnumeric() <span class="hljs-comment"># True if str contains only numeric characters.</span>
437440
&lt;list&gt; = textwrap.wrap(&lt;str&gt;, width) <span class="hljs-comment"># Nicely breaks string into lines.</span>
438441
</code></pre>
439442
<ul>

0 commit comments

Comments
 (0)