slice / substring / substr Playground

Cutting shelf labels: the same arguments, three methods. The board shows where slice, substring and substr really cut. An interactive slice / substring /…

Why it matters

Cutting strings is everywhere: file extensions, text snippets, parsing. Mixing the three up means subtle bugs (swapped arguments, a negative turned into 0). Knowing why slice wins means no more guessing.

The key idea

Three similar methods, but only slice is predictable

Try it in this playground