nrt-string-utils


Namenrt-string-utils JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/etuzon/python-nrt-string-utils
SummaryString utilities in Python
upload_time2024-12-16 08:47:31
maintainerNone
docs_urlNone
authorEyal Tuzon
requires_python>=3.8
licenseNone
keywords python python3 python-3 utilities utils util tool tools nrt nrt-utils string string-utils string-utilities nrt-string-utils nrt-string-utilities
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # String Utilities

### String utilities in Python.

![PyPI](https://img.shields.io/pypi/v/nrt-string-utils?color=blueviolet&style=plastic)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nrt-string-utils?color=greens&style=plastic)
![PyPI - License](https://img.shields.io/pypi/l/nrt-string-utils?color=blue&style=plastic)
![PyPI - Downloads](https://img.shields.io/pypi/dd/nrt-string-utils?style=plastic)
![PyPI - Downloads](https://img.shields.io/pypi/dm/nrt-string-utils?color=yellow&style=plastic)
[![Coverage Status](https://coveralls.io/repos/github/etuzon/python-nrt-string-utils/badge.svg)](https://coveralls.io/github/etuzon/pytohn-nrt-string-utils)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/etuzon/python-nrt-string-utils?style=plastic)
![GitHub last commit](https://img.shields.io/github/last-commit/etuzon/python-nrt-string-utils?style=plastic)
[![DeepSource](https://app.deepsource.com/gh/etuzon/python-nrt-string-utils.svg/?label=active+issues&show_trend=false&token=BiVHFqo8lcnkHT7oIOXLceZ3)](https://app.deepsource.com/gh/etuzon/python-nrt-string-utils/)

## StringUtil class

### Methods

| **Method**                        | **Description**                                                         | **Parameters**                                                                                                                                                              | **Returns**                                                                             |
|-----------------------------------|-------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|
| `decode_base64`                   | Decodes a base64 encoded string.                                        | `encoded_text (str)` The base64 encoded string to decode.                                                                                                                   | `str` The decoded string.                                                               |
| `encode_base64`                   | Encodes a string to base64.                                             | `text (str)` The string to encode.                                                                                                                                          | `str` The base64 encoded string.                                                        |
| `get_char_and_ascii_number_pairs` | Returns a list of tuples containing the character and its ASCII number. | `text (str)` The string to analyze.                                                                                                                                         | `list[tuple[str, int]]` A list of tuples containing the character and its ASCII number. |
| `get_emails`                      | Returns a list of email addresses found in a string.                    | `text (str)` The string to search for email addresses.                                                                                                                      | `list[str]` A list of email addresses found in the string (without duplications).       |
| `get_last_char`                   | Returns the last character of a string.                                 | `text (str)` The string to analyze.                                                                                                                                         | `str` The last character of the string.                                                 |
| `get_urls`                        | Returns a list of URLs found in a string.                               | `text (str)` The string to search for URLs.                                                                                                                                 | `list[str]` A list of URLs found in the string (without duplications).                  |
| `is_decimal`                      | Checks if a string is a decimal number.                                 | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is a decimal number, False otherwise.                         |
| `is_int`                          | Checks if a string is an integer.                                       | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is an integer, False otherwise.                               |
| `is_json`                         | Checks if a string is a valid JSON.                                     | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is a valid JSON, False otherwise.                             |
| `is_positive_decimal`             | Checks if a string is a positive decimal number.                        | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is a positive decimal number, False otherwise.                |
| `is_positive_int`                 | Checks if a string is a positive integer.                               | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is a positive integer, False otherwise.                       |
| `is_unsigned_decimal`             | Checks if a string is an unsigned decimal number.                       | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is an unsigned decimal number, False otherwise.               |
| `is_unsigned_int`                 | Checks if a string is an unsigned integer.                              | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is an unsigned integer, False otherwise.                      |
| `sub_string`                      | Returns a substring from a string.                                      | `text (str)` The string to extract the substring from.<br>`start_delimiter (str)` Sub string start delimiter.<br>`end_delimiter (Optional[str])` Sub string end delimiter.  | `str` The extracted substring.                                                          |
| `sub_string_list`                 | Returns a list of substrings from a string.                             | `text (str)` The string to extract the substrings from.<br>`start_delimiter (str)` Sub string start delimiter.<br>`end_delimiter (Optional[str])` Sub string end delimiter. | `list[str]` A list of extracted substrings.                                             |
| `to_ascii`                        | Converts a string to ASCII.                                             | `text (str)` The string to convert.                                                                                                                                         | `str` The ASCII representation of the string.                                           |

### Examples:

- #### StringUtil.decode_base64

    **Code**
    ```python
    from string_utils import StringUtil

    # Decode a base64 encoded string
    decoded_text = StringUtil.decode_base64('dGVzdA==')
    print(decoded_text)
    ```
    **Output**
    ```
    test
    ```

- #### StringUtil.encode_base64
    
    **Code**
    ```python
    from string_utils import StringUtil
    
    # Encode a string to base64
    encoded_text = StringUtil.encode_base64('test')
    print(encoded_text)
    ```
    **Output**
    ```
    dGVzdA==
    ```

- #### StringUtil.get_char_and_ascii_number_pairs

    **Code**
    ```python
    from string_utils import StringUtil
    
    # Get the character and its ASCII number pairs
    pairs = StringUtil.get_char_and_ascii_number_pairs('test')
    print(pairs)
    ```
    **Output**
    ```
    [('t', 116), ('e', 101), ('s', 115), ('t', 116)]
    ```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/etuzon/python-nrt-string-utils",
    "name": "nrt-string-utils",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "python, python3, python-3, utilities, utils, util, tool, tools, nrt, nrt-utils, string, string-utils, string-utilities, nrt-string-utils, nrt-string-utilities",
    "author": "Eyal Tuzon",
    "author_email": "Eyal Tuzon <eyal.tuzon.dev@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/78/9e/029c3e8b95467f2c38e26177bb4702f1074b64460fbadabf2c3f6ce23b46/nrt_string_utils-1.0.2.tar.gz",
    "platform": null,
    "description": "# String Utilities\r\n\r\n### String utilities in Python.\r\n\r\n![PyPI](https://img.shields.io/pypi/v/nrt-string-utils?color=blueviolet&style=plastic)\r\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nrt-string-utils?color=greens&style=plastic)\r\n![PyPI - License](https://img.shields.io/pypi/l/nrt-string-utils?color=blue&style=plastic)\r\n![PyPI - Downloads](https://img.shields.io/pypi/dd/nrt-string-utils?style=plastic)\r\n![PyPI - Downloads](https://img.shields.io/pypi/dm/nrt-string-utils?color=yellow&style=plastic)\r\n[![Coverage Status](https://coveralls.io/repos/github/etuzon/python-nrt-string-utils/badge.svg)](https://coveralls.io/github/etuzon/pytohn-nrt-string-utils)\r\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/etuzon/python-nrt-string-utils?style=plastic)\r\n![GitHub last commit](https://img.shields.io/github/last-commit/etuzon/python-nrt-string-utils?style=plastic)\r\n[![DeepSource](https://app.deepsource.com/gh/etuzon/python-nrt-string-utils.svg/?label=active+issues&show_trend=false&token=BiVHFqo8lcnkHT7oIOXLceZ3)](https://app.deepsource.com/gh/etuzon/python-nrt-string-utils/)\r\n\r\n## StringUtil class\r\n\r\n### Methods\r\n\r\n| **Method**                        | **Description**                                                         | **Parameters**                                                                                                                                                              | **Returns**                                                                             |\r\n|-----------------------------------|-------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|\r\n| `decode_base64`                   | Decodes a base64 encoded string.                                        | `encoded_text (str)` The base64 encoded string to decode.                                                                                                                   | `str` The decoded string.                                                               |\r\n| `encode_base64`                   | Encodes a string to base64.                                             | `text (str)` The string to encode.                                                                                                                                          | `str` The base64 encoded string.                                                        |\r\n| `get_char_and_ascii_number_pairs` | Returns a list of tuples containing the character and its ASCII number. | `text (str)` The string to analyze.                                                                                                                                         | `list[tuple[str, int]]` A list of tuples containing the character and its ASCII number. |\r\n| `get_emails`                      | Returns a list of email addresses found in a string.                    | `text (str)` The string to search for email addresses.                                                                                                                      | `list[str]` A list of email addresses found in the string (without duplications).       |\r\n| `get_last_char`                   | Returns the last character of a string.                                 | `text (str)` The string to analyze.                                                                                                                                         | `str` The last character of the string.                                                 |\r\n| `get_urls`                        | Returns a list of URLs found in a string.                               | `text (str)` The string to search for URLs.                                                                                                                                 | `list[str]` A list of URLs found in the string (without duplications).                  |\r\n| `is_decimal`                      | Checks if a string is a decimal number.                                 | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is a decimal number, False otherwise.                         |\r\n| `is_int`                          | Checks if a string is an integer.                                       | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is an integer, False otherwise.                               |\r\n| `is_json`                         | Checks if a string is a valid JSON.                                     | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is a valid JSON, False otherwise.                             |\r\n| `is_positive_decimal`             | Checks if a string is a positive decimal number.                        | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is a positive decimal number, False otherwise.                |\r\n| `is_positive_int`                 | Checks if a string is a positive integer.                               | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is a positive integer, False otherwise.                       |\r\n| `is_unsigned_decimal`             | Checks if a string is an unsigned decimal number.                       | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is an unsigned decimal number, False otherwise.               |\r\n| `is_unsigned_int`                 | Checks if a string is an unsigned integer.                              | `text (Optional[str])` The string to check.                                                                                                                                 | `bool` True if the string is an unsigned integer, False otherwise.                      |\r\n| `sub_string`                      | Returns a substring from a string.                                      | `text (str)` The string to extract the substring from.<br>`start_delimiter (str)` Sub string start delimiter.<br>`end_delimiter (Optional[str])` Sub string end delimiter.  | `str` The extracted substring.                                                          |\r\n| `sub_string_list`                 | Returns a list of substrings from a string.                             | `text (str)` The string to extract the substrings from.<br>`start_delimiter (str)` Sub string start delimiter.<br>`end_delimiter (Optional[str])` Sub string end delimiter. | `list[str]` A list of extracted substrings.                                             |\r\n| `to_ascii`                        | Converts a string to ASCII.                                             | `text (str)` The string to convert.                                                                                                                                         | `str` The ASCII representation of the string.                                           |\r\n\r\n### Examples:\r\n\r\n- #### StringUtil.decode_base64\r\n\r\n    **Code**\r\n    ```python\r\n    from string_utils import StringUtil\r\n\r\n    # Decode a base64 encoded string\r\n    decoded_text = StringUtil.decode_base64('dGVzdA==')\r\n    print(decoded_text)\r\n    ```\r\n    **Output**\r\n    ```\r\n    test\r\n    ```\r\n\r\n- #### StringUtil.encode_base64\r\n    \r\n    **Code**\r\n    ```python\r\n    from string_utils import StringUtil\r\n    \r\n    # Encode a string to base64\r\n    encoded_text = StringUtil.encode_base64('test')\r\n    print(encoded_text)\r\n    ```\r\n    **Output**\r\n    ```\r\n    dGVzdA==\r\n    ```\r\n\r\n- #### StringUtil.get_char_and_ascii_number_pairs\r\n\r\n    **Code**\r\n    ```python\r\n    from string_utils import StringUtil\r\n    \r\n    # Get the character and its ASCII number pairs\r\n    pairs = StringUtil.get_char_and_ascii_number_pairs('test')\r\n    print(pairs)\r\n    ```\r\n    **Output**\r\n    ```\r\n    [('t', 116), ('e', 101), ('s', 115), ('t', 116)]\r\n    ```\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "String utilities in Python",
    "version": "1.0.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/etuzon/python-nrt-string-utils/issues",
        "Homepage": "https://github.com/etuzon/python-nrt-string-utils",
        "documentation": "https://github.com/etuzon/python-nrt-string-utils/wiki"
    },
    "split_keywords": [
        "python",
        " python3",
        " python-3",
        " utilities",
        " utils",
        " util",
        " tool",
        " tools",
        " nrt",
        " nrt-utils",
        " string",
        " string-utils",
        " string-utilities",
        " nrt-string-utils",
        " nrt-string-utilities"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9441500266b4ebf32ad93bf812b09d5a20e4297ce6179b96cbde53b8a26aedeb",
                "md5": "45c0f4f4d9aca7cd1bace454d09919a5",
                "sha256": "f1fd735f9243a1586e89376f5be0a728aaaa595d037b27684a4d3d2bb434ba27"
            },
            "downloads": -1,
            "filename": "nrt_string_utils-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "45c0f4f4d9aca7cd1bace454d09919a5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5100,
            "upload_time": "2024-12-16T08:47:29",
            "upload_time_iso_8601": "2024-12-16T08:47:29.416564Z",
            "url": "https://files.pythonhosted.org/packages/94/41/500266b4ebf32ad93bf812b09d5a20e4297ce6179b96cbde53b8a26aedeb/nrt_string_utils-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "789e029c3e8b95467f2c38e26177bb4702f1074b64460fbadabf2c3f6ce23b46",
                "md5": "7db45e67be4e990c0d8b150b74d59c9e",
                "sha256": "52788c0b18b239e7ae20f91919368b77da62fe9467e1569cd88648d6a7de5363"
            },
            "downloads": -1,
            "filename": "nrt_string_utils-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "7db45e67be4e990c0d8b150b74d59c9e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 5712,
            "upload_time": "2024-12-16T08:47:31",
            "upload_time_iso_8601": "2024-12-16T08:47:31.885684Z",
            "url": "https://files.pythonhosted.org/packages/78/9e/029c3e8b95467f2c38e26177bb4702f1074b64460fbadabf2c3f6ce23b46/nrt_string_utils-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-16 08:47:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "etuzon",
    "github_project": "python-nrt-string-utils",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "lcname": "nrt-string-utils"
}
        
Elapsed time: 0.39318s