cool_string_douglasadams_42.CoolString¶
- class cool_string_douglasadams_42.CoolString(val, creator=None)¶
This class implements a CoolString object that is a string with additional features. It tries to implement as many magic methods as possible.
- Parameters:
val (str or any object that can be converted to a string.) – The value of the CoolString object.
creator (
CoolString
, optional) – An optional CoolString object that is used to copy the attributes of the creator object. It is used to create new CoolString objects with the same attributes as the creator object so settings get derived from the creator.
- __init__(val, creator=None)¶
Initializes a CoolString object with the given value and an optional creator object.
- Parameters:
val (str or any object that can be converted to a string.) – The value of the CoolString object.
creator (
CoolString
, optional) – An optional CoolString object that is used to copy the attributes of the creator object.
Methods
__init__
(val[, creator])Initializes a CoolString object with the given value and an optional creator object.
bitshift
(val, shift, direction)Performs a bitwise shift on the given string value.
classifyfloat
(val)Classifies the given value as a float and determines if it is positive or negative.
classifyint
(val)Classifies the given value as an integer and determines if it is positive or negative.
configure
(**kwargs)Configures the CoolString object with the given keyword arguments.
convertval
(val)Converts the given value to a string representation.
getcompval
(val)Gets the comparison value of the given value based on the configured comparison mode.
matchlengths
(val1, val2)Matches the lengths of two strings by padding the shorter one with spaces.