pip_services3_commons.convert.StringConverter module
pip_services3_commons.convert.StringConverter
String conversion utilities
- copyright
Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
- license
MIT, see LICENSE for more details.
-
class
pip_services3_commons.convert.StringConverter.
StringConverter
Bases:
object
Converts arbitrary values into strings using extended conversion __rules: - Numbers: are converted with ‘.’ as decimal point - DateTime: using ISO format - Boolean: “true” for true and “false” for false - Arrays: as comma-separated list - Other objects: using
to_string()
methodExample:
value1 = StringConverter.to_string(123.456) # Result: "123.456" value2 = StringConverter.to_string(true) # Result: "true" value3 = StringConverter.to_string(datetime.datetime(2018,0,1)) # Result: "2018-01-01T00:00:00.00" value4 = StringConverter.to_string([1,2,3]) # Result: "1,2,3"
-
static
to_nullable_string
(value: Any) → Optional[str, None] Converts args into string or returns None when args is None.
- Parameters
value – the args to convert.
- Returns
string args or None when args is None.
-
static