tssplit


Nametssplit JSON
Version 1.0.8 PyPI version JSON
download
home_pagehttps://github.com/mezantrop/tssplit
SummaryTrivial split for strings with quotes and escaped characters
upload_time2024-10-19 11:40:59
maintainerNone
docs_urlNone
authorMikhail Zakharov
requires_pythonNone
licensebsd-2-clause
keywords split parse quote trim strip string delimiter separator
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Trivial split for strings with multiple character delimiters, quotes and escaped characters

[![Downloads](https://pepy.tech/badge/tssplit/month)](https://pepy.tech/project/tssplit)
<a href="https://www.buymeacoffee.com/mezantrop" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>

## Installation

```shell script
pip install tssplit
```

## Usage

### Syntax

```Python3
def tssplit(s, quote='"\'', quote_keep=False, delimiter=':;,', escape='/^', trim='', remark='#'):
    """Split a string by delimiters with quotes and escaped characters, optionally trimming results

    :param s: A string to split into chunks
    :param quote: Quote chars to protect a part of s from parsing
    :param quote_keep: Preserve quote characters in the output or not
    :param delimiter: A chunk separator character
    :param escape: An escape character
    :param trim: Trim characters from chunks
    :param remark: Ignore all characters after remark sign
    :return: A list of chunks
    """
```

### Example

```Python3
from tssplit import tssplit

tssplit('--:--;--,--"--/--"--\'--:--\'--/"--^--',
        quote='"\'', delimiter=':;,', escape='/^', trim='')
['--', '--', '--', '----/------:----"----']

tssplit('--:--;--,--"--/--"--\'--:--\'--/"--^--',
        quote='"\'', delimiter=':;,', escape='/^', trim='', quote_keep=True)
['--', '--', '--', '--"--/--"--\'--:--\'--"----']

tssplit('--:--;--,--"--/--"--\'--:--\'--# Ignore this',
        quote='"\'', delimiter=':;,', escape='/^', trim='', quote_keep=True, remark='#')
['--', '--', '--', '--"--/--"--\'--:--\'--']
```

## Changelog

* 2020.03.28    v1.0    Initial release
* 2020.03.28    v1.0.1  Many quick fixes to make all things work in PyPI
* 2020.03.29    v1.0.2  Minor fixes, Readme update, Long description provided
* 2020.03.29    v1.0.3  Trim option to strip() characters from chunks
* 2020.03.29    v1.0.4  Multiple characters for quotes, delimiters and escapes
* 2022.02.04    v1.0.5  Added `quote_keep` option to preserve quote marks in the output or not
* 2023.01.12    v1.0.6  Remark characters interrupt string parsing
* 2024.04.03    v1.0.7  Cosmetics to make pylint happy
* 2024.10.19    v1.0.8  Better module import; minor cosmetic changes

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mezantrop/tssplit",
    "name": "tssplit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "split, parse, quote, trim, strip, string, delimiter, separator",
    "author": "Mikhail Zakharov",
    "author_email": "zmey20000@yahoo.com",
    "download_url": "https://files.pythonhosted.org/packages/7c/b4/db6e346d9c2efa0d07fe04923615c0ad920d1317d9772f964bd413aa7c39/tssplit-1.0.8.tar.gz",
    "platform": null,
    "description": "# Trivial split for strings with multiple character delimiters, quotes and escaped characters\n\n[![Downloads](https://pepy.tech/badge/tssplit/month)](https://pepy.tech/project/tssplit)\n<a href=\"https://www.buymeacoffee.com/mezantrop\" target=\"_blank\"><img src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" height=\"41\" width=\"174\"></a>\n\n## Installation\n\n```shell script\npip install tssplit\n```\n\n## Usage\n\n### Syntax\n\n```Python3\ndef tssplit(s, quote='\"\\'', quote_keep=False, delimiter=':;,', escape='/^', trim='', remark='#'):\n    \"\"\"Split a string by delimiters with quotes and escaped characters, optionally trimming results\n\n    :param s: A string to split into chunks\n    :param quote: Quote chars to protect a part of s from parsing\n    :param quote_keep: Preserve quote characters in the output or not\n    :param delimiter: A chunk separator character\n    :param escape: An escape character\n    :param trim: Trim characters from chunks\n    :param remark: Ignore all characters after remark sign\n    :return: A list of chunks\n    \"\"\"\n```\n\n### Example\n\n```Python3\nfrom tssplit import tssplit\n\ntssplit('--:--;--,--\"--/--\"--\\'--:--\\'--/\"--^--',\n        quote='\"\\'', delimiter=':;,', escape='/^', trim='')\n['--', '--', '--', '----/------:----\"----']\n\ntssplit('--:--;--,--\"--/--\"--\\'--:--\\'--/\"--^--',\n        quote='\"\\'', delimiter=':;,', escape='/^', trim='', quote_keep=True)\n['--', '--', '--', '--\"--/--\"--\\'--:--\\'--\"----']\n\ntssplit('--:--;--,--\"--/--\"--\\'--:--\\'--# Ignore this',\n        quote='\"\\'', delimiter=':;,', escape='/^', trim='', quote_keep=True, remark='#')\n['--', '--', '--', '--\"--/--\"--\\'--:--\\'--']\n```\n\n## Changelog\n\n* 2020.03.28    v1.0    Initial release\n* 2020.03.28    v1.0.1  Many quick fixes to make all things work in PyPI\n* 2020.03.29    v1.0.2  Minor fixes, Readme update, Long description provided\n* 2020.03.29    v1.0.3  Trim option to strip() characters from chunks\n* 2020.03.29    v1.0.4  Multiple characters for quotes, delimiters and escapes\n* 2022.02.04    v1.0.5  Added `quote_keep` option to preserve quote marks in the output or not\n* 2023.01.12    v1.0.6  Remark characters interrupt string parsing\n* 2024.04.03    v1.0.7  Cosmetics to make pylint happy\n* 2024.10.19    v1.0.8  Better module import; minor cosmetic changes\n",
    "bugtrack_url": null,
    "license": "bsd-2-clause",
    "summary": "Trivial split for strings with quotes and escaped characters",
    "version": "1.0.8",
    "project_urls": {
        "Homepage": "https://github.com/mezantrop/tssplit"
    },
    "split_keywords": [
        "split",
        " parse",
        " quote",
        " trim",
        " strip",
        " string",
        " delimiter",
        " separator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a34306fe1fd0593aa7d018c8f87f1c707b951320932025d41fcdea8a8aebb69f",
                "md5": "65e0654c4e055aa46a59cda729fe3144",
                "sha256": "d7973c2ba1a200b69608d1d57bda7928384c8f818d0942f0265b143767f15221"
            },
            "downloads": -1,
            "filename": "tssplit-1.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "65e0654c4e055aa46a59cda729fe3144",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 3992,
            "upload_time": "2024-10-19T11:40:58",
            "upload_time_iso_8601": "2024-10-19T11:40:58.563151Z",
            "url": "https://files.pythonhosted.org/packages/a3/43/06fe1fd0593aa7d018c8f87f1c707b951320932025d41fcdea8a8aebb69f/tssplit-1.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7cb4db6e346d9c2efa0d07fe04923615c0ad920d1317d9772f964bd413aa7c39",
                "md5": "d4843e438205f338995d2e6dd7b2fa98",
                "sha256": "364ba476631f613690a9ce5d1552cf104e650e714d0567e4867452d0a0df266f"
            },
            "downloads": -1,
            "filename": "tssplit-1.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "d4843e438205f338995d2e6dd7b2fa98",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3337,
            "upload_time": "2024-10-19T11:40:59",
            "upload_time_iso_8601": "2024-10-19T11:40:59.538586Z",
            "url": "https://files.pythonhosted.org/packages/7c/b4/db6e346d9c2efa0d07fe04923615c0ad920d1317d9772f964bd413aa7c39/tssplit-1.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-19 11:40:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mezantrop",
    "github_project": "tssplit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tssplit"
}
        
Elapsed time: 0.48216s