← TechnologyThe essentials of

substring(): the final position remains outside the snippet

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 21 Oct 2026 12:40. This is not editorial approval.

In a few sentences

In brief

Interchanged boundaries have a specific behavior.

Useful to know

substring(start, end) returns a part of a string to end, without including this position. In "abcdef".substring(1, 4), the result is "bcd". If the beginning is greater than the end, the method swaps the two values . [1]

This distinguishes it from some other extraction methods. In the case of a boundary code, do not count the swapped indices to necessarily give an empty result. Positions are in UTF-16 units; cutting at random can divide complex Unicode representation. For visible symbols and words, select the appropriate processing level.

Sources

For further detail and to check the information:

  1. [1] MDN — String.substring ↗