Primitive operations onstrings are basic operations that can
be performed directly on string data types. Here’s a summary:
1. Concatenation:
Combine two strings
using +
(e.g., "Hello" + "
World" "Hello
→
World").
2. Case Conversion:
Change case using
methods
like .lower(), .upper(),
.capitalize(), etc.
3. Indexing: Access a
character by its
position using square
brackets
(e.g., "Hello"[1] "e").
→
4. Slicing: Extract a
substring using
[start:end]
(e.g., "Hello"[1:4] →
"ell").
5. Length: Find the
number of
characters using
len()
(e.g., len("Hello") →
5).