StringConverter class
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
toString()
method
Example
var value1 = StringConverter.ToString(123.456); // Result: '123.456'
var value2 = StringConverter.ToString(true); // Result: 'true'
var value3 = StringConverter.ToString( Date(2018,0,1)); // Result: '2018-01-01T00:00:00.00'
var value4 = StringConverter.ToString([1,2,3]); // Result: '1,2,3'
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
toNullableString(
dynamic value) → String? - Converts value into string or returns null when value is null.
-
toString2(
dynamic value) → String - Converts value into string or returns '' when value is null.
-
toStringWithDefault(
dynamic value, String defaultValue) → String - Converts value into string or returns default when value is null.