Skip to content

Commit

Permalink
Update README to include updated encoders
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Shephard committed Apr 16, 2024
1 parent 6338bf0 commit 1680e60
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,27 @@ string directoryPath = FileInput.GetDirectoryPath("Enter a directory path");

The following encoders are available:

| Encoder | Character set |
|--------------------------|---------------------|
| Base2Encoder | 0-1 |
| Base10Encoder | 0-9 |
| Base16Encoder | 0-9, A-F |
| Base36Encoder | 0-9, A-Z |
| Base64Encoder | A-Z, a-z, 0-9, +, / |
| Base64Encoder (URI safe) | A-Z, a-z, 0-9, -, _ |
| Encoder | Character set |
|-----------------------|---------------------|
| Encoder.Base2 | 0-1 |
| Encoder.Base10 | 0-9 |
| Encoder.Base16 | 0-9, A-F |
| Encoder.Base36 | 0-9, A-Z |
| Encoder.Base62 | 0-9, A-Z, a-z |
| Encoder.Base64 | A-Z, a-z, 0-9, +, / |
| Encoder.Base64UriSafe | A-Z, a-z, 0-9, -, _ |

#### Encode text

Encode a byte array using one of the available encoders. The encoded text is returned as a string.

```csharp
using IOUtils.Encoders;
using IOUtils.Data;

byte[] raw = "Hello, World!"u8.ToArray();

// Any encoder listed above can be used here
string encoded = Base36Encoder.Encode(raw);
string encoded = Encoder.Base36.Encode(raw);

Console.WriteLine($"Encoded text: {encoded}");
```
Expand All @@ -134,11 +135,11 @@ Console.WriteLine($"Encoded text: {encoded}");
Decode a string encoded using one of the available encoders. The decoded text is returned as a byte array. If the encoded text is not valid, a FormatException is thrown.

```csharp
using IOUtils.Encoders;
using IOUtils.Data;

string encoded = "FG3H7VQW7EEN6JWWNZMP";

byte[] decoded = Base36Encoder.Decode(encoded);
byte[] decoded = Encoder.Base36.Decode(encoded);

Console.WriteLine($"Decoded text: {System.Text.Encoding.UTF8.GetString(decoded)}");
```
Expand Down

0 comments on commit 1680e60

Please sign in to comment.