# StringTools

A **StringTools** object provides several utility methods for encoding and decoding strings. For example, you can use a **StringTools** object to Base64-encode a chunk of data, or decode a UTF-8 encoded message header.

You can obtain a **StringTools** object using the [**DOpusFactory**](dopusfactory)**.StringTools** method.

| Method Name                                                          | **Arguments**                                                                                                                                                                                                                   | Return Type                                                           | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Decode                                                               | <p>&#x3C;<a href="blob"><strong>Blob</strong></a>:source> or &#x3C;string:source><br>&#x3C;string:format></p>                                                                                                                   | <p><em>string</em> or<br><a href="blob"><strong>Blob</strong></a></p> | <p>Decodes an encoded string or data.</p><p>You can provide either a <a href="blob"><strong>Blob</strong></a> object or a string as the <em>source</em> to decode. Depending on the value of the <em>format</em> argument, either a string or a <a href="blob"><strong>Blob</strong></a> is returned. Valid formats are:</p><table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>base64</strong></td><td>The source will be <em>Base64</em>-decoded, and a <a href="https://github.com/Chaoses-Ib/DirectoryOpus/blob/main/Manual/reference/scripting_reference/scripting_objects/blob/README.md"><strong>Blob</strong></a> is returned.</td></tr><tr><td><strong>quoted</strong></td><td>The source will be <em>Quoted-printable</em>-decoded, and a <a href="https://github.com/Chaoses-Ib/DirectoryOpus/blob/main/Manual/reference/scripting_reference/scripting_objects/blob/README.md"><strong>Blob</strong></a> is returned.</td></tr><tr><td><strong>utf-8</strong></td><td>The source will be converted from UTF-8 to a native string.</td></tr><tr><td><strong>utf-16</strong><br><strong>utf-16-le</strong></td><td>The source will be converted from UTF-16 Little Endian to a native string.</td></tr><tr><td><strong>utf-16-be</strong></td><td>The source will be converted from UTF-16 Big Endian to a native string.</td></tr><tr><td><strong>auto</strong></td><td>Special handling is invoked to decode a MIME-encoded email subject (e.g. one beginning with <strong>=?</strong>), and a string is returned if identified. It will also detect UTF-8 or UTF-16 encoded data if it has a BOM at the beginning.</td></tr></tbody></table><p>If decoding UTF-8 or UTF-16 (via <strong>"auto"</strong> or <strong>"utf-8"</strong>, etc.), any byte-order-mark (BOM) will be skipped if one exists at the beginning of the input data.</p><p>If <em>format</em> is not specified the default is <strong>auto</strong>. Otherwise, <em>format</em> must be set to one of the above keywords or a valid code-page name (e.g. <strong>"gb2312"</strong>, <strong>"utf-8"</strong>), or a Windows code-page ID (e.g. <strong>936</strong>, <strong>65001</strong>). The source will be decoded using the specified code-page and a string is returned.</p> |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **base64**                                                           | The source will be _Base64_-decoded, and a [**Blob**](https://github.com/Chaoses-Ib/DirectoryOpus/blob/main/Manual/reference/scripting_reference/scripting_objects/blob/README.md) is returned.                                 |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **quoted**                                                           | The source will be _Quoted-printable_-decoded, and a [**Blob**](https://github.com/Chaoses-Ib/DirectoryOpus/blob/main/Manual/reference/scripting_reference/scripting_objects/blob/README.md) is returned.                       |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **utf-8**                                                            | The source will be converted from UTF-8 to a native string.                                                                                                                                                                     |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| <p><strong>utf-16</strong><br><strong>utf-16-le</strong></p>         | The source will be converted from UTF-16 Little Endian to a native string.                                                                                                                                                      |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **utf-16-be**                                                        | The source will be converted from UTF-16 Big Endian to a native string.                                                                                                                                                         |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **auto**                                                             | Special handling is invoked to decode a MIME-encoded email subject (e.g. one beginning with **=?**), and a string is returned if identified. It will also detect UTF-8 or UTF-16 encoded data if it has a BOM at the beginning. |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| Encode                                                               | <p>&#x3C;<a href="blob"><strong>Blob</strong></a>:source> or &#x3C;string:source><br>&#x3C;string:format></p>                                                                                                                   | <p><em>string</em> or<br><a href="blob"><strong>Blob</strong></a></p> | <p>Encodes a string or data.</p><p>You can provide either a <a href="blob"><strong>Blob</strong></a> object or a string as the <em>source</em> to decode. Depending on the value of the <em>format</em> argument, either a string or a <a href="blob"><strong>Blob</strong></a> is returned. Valid formats are:</p><table data-header-hidden><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>base64</strong></td><td>The source will be <em>Base64</em>-encoded, and a string is returned.</td></tr><tr><td><strong>quoted</strong></td><td>The source will be <em>Quoted-printable</em>-encoded, and a string is returned.</td></tr><tr><td><strong>utf-8</strong></td><td>The source will be converted to UTF-8 without a byte-order-mark (BOM).</td></tr><tr><td><strong>utf-8 bom</strong></td><td>The source will be converted to UTF-8 with a BOM at the start.</td></tr><tr><td><strong>utf-16</strong><br><strong>utf-16-le</strong></td><td>The source will be converted to UTF-16 Little Endian without a BOM.</td></tr><tr><td><strong>utf-16 bom</strong><br><strong>utf-16-le bom</strong></td><td>The source will be converted to UTF-16 Little Endian with a BOM.</td></tr><tr><td><strong>utf-16-be</strong></td><td>The source will be converted to UTF-16 Big Endian without a BOM.</td></tr><tr><td><strong>utf-16-be bom</strong></td><td>The source will be converted to UTF-16 Big Endian with a BOM.</td></tr></tbody></table><p>Otherwise, <em>format</em> must be set to a valid code-page name (e.g. <strong>"gb2312"</strong>, <strong>"utf-8"</strong> etc.), or a Windows code-page ID (e.g. <strong>936</strong>, <strong>65001</strong>). The source will be encoded using the specified code-page and a <a href="blob"><strong>Blob</strong></a> is returned.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **base64**                                                           | The source will be _Base64_-encoded, and a string is returned.                                                                                                                                                                  |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **quoted**                                                           | The source will be _Quoted-printable_-encoded, and a string is returned.                                                                                                                                                        |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **utf-8**                                                            | The source will be converted to UTF-8 without a byte-order-mark (BOM).                                                                                                                                                          |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **utf-8 bom**                                                        | The source will be converted to UTF-8 with a BOM at the start.                                                                                                                                                                  |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| <p><strong>utf-16</strong><br><strong>utf-16-le</strong></p>         | The source will be converted to UTF-16 Little Endian without a BOM.                                                                                                                                                             |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| <p><strong>utf-16 bom</strong><br><strong>utf-16-le bom</strong></p> | The source will be converted to UTF-16 Little Endian with a BOM.                                                                                                                                                                |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **utf-16-be**                                                        | The source will be converted to UTF-16 Big Endian without a BOM.                                                                                                                                                                |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **utf-16-be bom**                                                    | The source will be converted to UTF-16 Big Endian with a BOM.                                                                                                                                                                   |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| IsASCII                                                              | \<string:input>                                                                                                                                                                                                                 | _bool_                                                                | <p>Tests the input string to see if it only contains characters that can be represented in ASCII.</p><p>If the result is false, the string is not safe to save into a text file unless you use a Unicode format such as UTF-8.</p><p>This check is not affected by locales or codepages. Instead, it tests whether the string consists of only 7-bit ASCII characters, such that no characters will be lost or modified if you save the string to a text file and then load it back on any other computer.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| LanguageStr                                                          | <p>&#x3C;string:name> or<br>&#x3C;int:id></p>                                                                                                                                                                                   | _string_                                                              | <p>Returns a translated string in the currently selected language. Mainly needed for internal use.</p><p>The currently defined strings are:</p><table><thead><tr><th>ID</th><th>English language string</th><th></th></tr></thead><tbody><tr><td>FavoritesBar</td><td>Favorites Bar</td><td></td></tr><tr><td>FindResults</td><td>Find Results</td><td></td></tr><tr><td>CopySelection</td><td>Copy Selection</td><td></td></tr><tr><td>CopyAll</td><td>Copy All</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>MakeLegal</td><td></td><td></td></tr></tbody></table><p>&#x3C;string:name> [&#x3C;string:flags>]</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | _string_ | <p>Strips any illegal filename characters from the supplied string.</p><p>The optional flags are:</p><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><strong>f</strong></td><td>forward slashes: convert separators to <code>/</code> instead of <code>\</code></td><td></td></tr><tr><td><strong>n</strong></td><td>name instead of path: replace separators with <code>_</code> (implies <strong>s</strong>)</td><td></td></tr><tr><td><strong>s</strong></td><td>subdirectory mode: replace <code>:</code> with <code>;</code> and remove <code>\\</code> from UNC paths</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>RemoveDiacritics</td><td></td><td></td></tr></tbody></table><p>&#x3C;string:input></p> | _string_ | <p>Returns a copy of the input string with any diacritics (accent symbols) removed. For example, "á" would be converted to "a".</p><p>This function uses the same rules that are used by the "ignore diacritics" options for pattern matching throughout Opus.</p> |
| ID                                                                   | English language string                                                                                                                                                                                                         |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| FavoritesBar                                                         | Favorites Bar                                                                                                                                                                                                                   |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| FindResults                                                          | Find Results                                                                                                                                                                                                                    |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| CopySelection                                                        | Copy Selection                                                                                                                                                                                                                  |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| CopyAll                                                              | Copy All                                                                                                                                                                                                                        |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
|                                                                      |                                                                                                                                                                                                                                 |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
|                                                                      |                                                                                                                                                                                                                                 |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| MakeLegal                                                            |                                                                                                                                                                                                                                 |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
|                                                                      |                                                                                                                                                                                                                                 |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **f**                                                                | forward slashes: convert separators to `/` instead of `\`                                                                                                                                                                       |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **n**                                                                | name instead of path: replace separators with `_` (implies **s**)                                                                                                                                                               |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| **s**                                                                | subdirectory mode: replace `:` with `;` and remove `\\` from UNC paths                                                                                                                                                          |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
|                                                                      |                                                                                                                                                                                                                                 |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
|                                                                      |                                                                                                                                                                                                                                 |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| RemoveDiacritics                                                     |                                                                                                                                                                                                                                 |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| Truncate                                                             | \<string:input> or _object_:[Path](path) \<int:length> \[\<int:type>]                                                                                                                                                           | _string_                                                              | <p>Truncates the specified input string to the requested number of characters.</p><p>The optional <em>type</em> argument specifies the truncation type. Valid values are:</p><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td>0</td><td>truncate on the right</td></tr><tr><td>1</td><td>truncate on the left</td></tr><tr><td>2</td><td>truncate in the middle</td></tr></tbody></table><p>If not specified, the default is <strong>2</strong> if <em>input</em> is a <a href="path">Path</a> object, otherwise the default is <strong>0</strong>.</p><p>If the input value is a <a href="path">Path</a> and middle truncation is selected, the function takes path separators into account correctly.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
|                                                                      |                                                                                                                                                                                                                                 |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| 0                                                                    | truncate on the right                                                                                                                                                                                                           |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| 1                                                                    | truncate on the left                                                                                                                                                                                                            |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
| 2                                                                    | truncate in the middle                                                                                                                                                                                                          |                                                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |          |                                                                                                                                                                                                                                                                    |
