Skip to content

Files

Latest commit

 

History

History
21 lines (15 loc) · 490 Bytes

prefer-string-trim-start-end.md

File metadata and controls

21 lines (15 loc) · 490 Bytes

Pattern: Directional trim method names

Issue: -

Description

The trimLeft and trimRight methods are legacy aliases that can be confusing due to their direction-dependent naming. Use trimStart and trimEnd instead for better consistency with other language features and clearer directional independence.

Examples

Example of incorrect code:

str.trimLeft();
str.trimRight();

Example of correct code:

str.trimStart();
str.trimEnd();