From d501423ade302c4a1fd5ca87e7279b386ef74bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sat, 30 Nov 2019 07:11:30 +0100 Subject: [PATCH] String --- README.md | 13 ++++++------- index.html | 9 ++++----- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 3d97e68..bc2be9c 100644 --- a/README.md +++ b/README.md @@ -325,10 +325,15 @@ String = .translate() # Use `str.maketrans()` to generate table. = textwrap.wrap(, width) # Nicely breaks string into lines. ``` + +```python + = chr() # Converts int to unicode char. + = ord() # Converts unicode char to int. +``` * **Also: `'lstrip()'`, `'rstrip()'`.** * **Also: `'lower()'`, `'upper()'`, `'capitalize()'` and `'title()'`.** -### Properties +### Property Methods ```text +---------------+----------+----------+----------+----------+----------+----------+ | | [\t\n\r] | [ !#$%…] | [A-Za-z] | [¼½¾…] | [¹²³…] | [0-9] | @@ -341,12 +346,6 @@ String +---------------+----------+----------+----------+----------+----------+----------+ ``` -### Char -```python - = chr() # Converts int to unicode char. - = ord() # Converts unicode char to int. -``` - Regex ----- diff --git a/index.html b/index.html index 19628f5..10974e8 100644 --- a/index.html +++ b/index.html @@ -436,11 +436,14 @@ to_exclusive = <range>.stop <str> = <str>.translate(<table>) # Use `str.maketrans(<dict>)` to generate table. <list> = textwrap.wrap(<str>, width) # Nicely breaks string into lines. +
<str>  = chr(<int>)                          # Converts int to unicode char.
+<int>  = ord(<str>)                          # Converts unicode char to int.
+
  • Also: 'lstrip()', 'rstrip()'.
  • Also: 'lower()', 'upper()', 'capitalize()' and 'title()'.
-

Properties

+---------------+----------+----------+----------+----------+----------+----------+
+

Property Methods

+---------------+----------+----------+----------+----------+----------+----------+
 |               | [\t\n\r] | [ !#$%…] | [A-Za-z] |  [¼½¾…]  |  [¹²³…]  |  [0-9]   |
 +---------------+----------+----------+----------+----------+----------+----------+
 | isprintable() |          |   yes    |   yes    |   yes    |   yes    |   yes    |
@@ -451,10 +454,6 @@ to_exclusive   = <range>.stop
 +---------------+----------+----------+----------+----------+----------+----------+
 
-

Char

<str> = chr(<int>)                           # Converts int to unicode char.
-<int> = ord(<str>)                           # Converts unicode char to int.
-
-

#Regex

import re
 <str>   = re.sub(<regex>, new, text, count=0)  # Substitutes all occurrences.
 <list>  = re.findall(<regex>, text)            # Returns all occurrences.