dart-code-checker/dart-code-metrics

[New rule] avoid-substring

fzyzcjy opened this issue ยท 5 comments

Rule details

As we know, using String.substring method will cause problems if you are having emojis in the string. There are many articles in the web, such as dart-lang/sdk#35798. Users should replace s.substring(100,200) with s.characters.getRange(100,200).

What type of rule is this?

Warns about a potential problem

Example code

s.substring(100,200); // LINT


### Participation

- [ ] I am willing to submit a pull request to implement this rule.

### Additional comments

_No response_

@fzyzcjy do you want to implement it yourself? If not, all new rules implemented by me are added to the Teams version only.

I'd also be happy to give you the Teams version license for your effort on DCM. If you're interested, please mail me at incendial@dcm.dev

@incendial Hi, I do not have a strong need for the Teams license currently, but thanks for providing the license to me!

I'm going to do it.

Available in 5.7.0 ๐Ÿš€