dart_common_utilities
dart_common_utilities copied to clipboard
removeAt only removes first match
You can see in the source code that removeAt(int index) only removes the first match:
/// remove the character in [index] of the given string.
String removeAt(int index) {
var selectStr = _mainStr[index];
return _mainStr.replaceFirst('$selectStr', '');
}
This implementation is wrong. The following code shows how this can appear:
// 01234567
var str1 = "12.34.56";
print(str1.stringUtils().removeAt(5));
The element at position 5 was not removed, instead the element at position 2 was.