tssplit


Nametssplit JSON
Version 1.0.7 PyPI version JSON
download
home_pagehttps://github.com/mezantrop/tssplit
SummaryTrivial split for strings with quotes and escaped characters
upload_time2024-04-03 15:22:07
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

            

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/00/c8/75177fe3a6e1fbce5753467018f484635f351ff3ed07e4d2dcbb89232af6/tssplit-1.0.7.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",
    "bugtrack_url": null,
    "license": "bsd-2-clause",
    "summary": "Trivial split for strings with quotes and escaped characters",
    "version": "1.0.7",
    "project_urls": {
        "Homepage": "https://github.com/mezantrop/tssplit"
    },
    "split_keywords": [
        "split",
        " parse",
        " quote",
        " trim",
        " strip",
        " string",
        " delimiter",
        " separator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "acd1abd5ab7d4abee58fb4391bd569d66bc117e4ba1213c47b8e84cef7f99905",
                "md5": "9bf9119de4bbae93d3a7000e98b8cc25",
                "sha256": "6b5a96ff1c6fcb2aa3d0f6e287ac61d6f3cf74b781510b3e8d68c943f8988ab4"
            },
            "downloads": -1,
            "filename": "tssplit-1.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9bf9119de4bbae93d3a7000e98b8cc25",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 3960,
            "upload_time": "2024-04-03T15:22:06",
            "upload_time_iso_8601": "2024-04-03T15:22:06.658887Z",
            "url": "https://files.pythonhosted.org/packages/ac/d1/abd5ab7d4abee58fb4391bd569d66bc117e4ba1213c47b8e84cef7f99905/tssplit-1.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "00c875177fe3a6e1fbce5753467018f484635f351ff3ed07e4d2dcbb89232af6",
                "md5": "8dff135bbc341d7e2746afbfe001857e",
                "sha256": "6831454f8ad8a1832c629e3e64591560d135b0ef2554f3e53042abf82835cced"
            },
            "downloads": -1,
            "filename": "tssplit-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "8dff135bbc341d7e2746afbfe001857e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3301,
            "upload_time": "2024-04-03T15:22:07",
            "upload_time_iso_8601": "2024-04-03T15:22:07.755338Z",
            "url": "https://files.pythonhosted.org/packages/00/c8/75177fe3a6e1fbce5753467018f484635f351ff3ed07e4d2dcbb89232af6/tssplit-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-03 15:22:07",
    "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.22453s