substring method Null safety
The substring of the string value from start
, inclusive, to end
, exclusive.
Returns null if the string value is null
Example:
const string = 'dougsmith';
var result = string.substring(1); // 'ougsmith'
result = string.substring(1, 3); // 'oug'
Both start
and end
must be non-negative and no greater than length;
end
, if provided, must be greater than or equal to start
.
Implementation
String? substring(int start, [int? end]) => _value?.substring(start, end);