From 0d7cc822676c8795a28c62d80d4eafdcbc3b85d5 Mon Sep 17 00:00:00 2001 From: Denny Crane Date: Tue, 30 Aug 2022 11:08:23 -0300 Subject: [PATCH] Update string-functions.md --- .../functions/string-functions.md | 55 ++++++++++++++----- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/docs/en/sql-reference/functions/string-functions.md b/docs/en/sql-reference/functions/string-functions.md index af265aba18f..45187abf61b 100644 --- a/docs/en/sql-reference/functions/string-functions.md +++ b/docs/en/sql-reference/functions/string-functions.md @@ -495,25 +495,23 @@ If the ‘s’ string is non-empty and does not contain the ‘c’ character at Returns the string ‘s’ that was converted from the encoding in ‘from’ to the encoding in ‘to’. -## base58Encode(plaintext), base58Decode(encoded_text) +## base58Encode(plaintext) -Accepts a String and encodes/decodes it using [Base58](https://tools.ietf.org/id/draft-msporny-base58-01.html) encoding scheme using "Bitcoin" alphabet. +Accepts a String and encodes it using [Base58](https://tools.ietf.org/id/draft-msporny-base58-01.html) encoding scheme using "Bitcoin" alphabet. **Syntax** ```sql -base58Encode(decoded) -base58Decode(encoded) +base58Encode(plaintext) ``` **Arguments** -- `decoded` — [String](../../sql-reference/data-types/string.md) column or constant. -- `encoded` — [String](../../sql-reference/data-types/string.md) column or constant. If the string is not a valid base58-encoded value, an exception is thrown. +- `plaintext` — [String](../../sql-reference/data-types/string.md) column or constant. **Returned value** -- A string containing encoded/decoded value of 1st argument. +- A string containing encoded value of 1st argument. Type: [String](../../sql-reference/data-types/string.md). @@ -523,17 +521,48 @@ Query: ``` sql SELECT base58Encode('Encoded'); +``` + +Result: +```text +┌─base58Encode('Encoded')─┐ +│ 3dc8KtHrwM │ +└─────────────────────────┘ +``` + +## base58Decode(encoded_text) + +Accepts a String and decodes it using [Base58](https://tools.ietf.org/id/draft-msporny-base58-01.html) encoding scheme using "Bitcoin" alphabet. + +**Syntax** + +```sql +base58Decode(encoded_text) +``` + +**Arguments** + +- `encoded_text` — [String](../../sql-reference/data-types/string.md) column or constant. If the string is not a valid base58-encoded value, an exception is thrown. + +**Returned value** + +- A string containing decoded value of 1st argument. + +Type: [String](../../sql-reference/data-types/string.md). + +**Example** + +Query: + +``` sql SELECT base58Decode('3dc8KtHrwM'); ``` Result: ```text -┌─encodeBase58('Encoded')─┐ -│ 3dc8KtHrwM │ -└──────────────────────────────────┘ -┌─decodeBase58('3dc8KtHrwM')─┐ -│ Encoded │ -└────────────────────────────────────┘ +┌─base58Decode('3dc8KtHrwM')─┐ +│ Encoded │ +└────────────────────────────┘ ``` ## base64Encode(s)