Skip to content
This repository was archived by the owner on Dec 13, 2020. It is now read-only.
This repository was archived by the owner on Dec 13, 2020. It is now read-only.

Slicing is not consistent between a regular string and a Colorclass string #23

@kizbitz

Description

@kizbitz
Python 2.7.13 (default, Jul 24 2017, 20:13:18)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from colorclass import Color

>>> s = 'This is a test string ...'
>>> c = Color('{autogreen}This is a test string ...{/autogreen}')

>>> print s
This is a test string ...
>>> print c
This is a test string ...
>>> print s[:14]
This is a test
>>> print c[:14]
This is a

# work around
>>> print c.value_colors.replace(c.value_no_colors, c.value_no_colors[:14])
This is a test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions