Skip to content

String Manipulation

Programming

Learn string ops: slicing, searching, replacing, splitting, building.

Official Site
01

Overview

Strings are immutable. Use template literals (JS) and f-strings (Python) for interpolation. Use array.join() for building — += in loop is O(n^2).

bash
"hello".slice(1,4); // "ell"
"a-b-c".replaceAll("-","_");
[...parts].join("/");
02

Best Practices

Use join for building from many parts. Use template literals/f-strings. Compile regex once. Beware Unicode: str.length counts UTF-16 units.

Ready to try String Manipulation?

Visit the official site for the latest version and full documentation.

Visit String Manipulation