PCAP String Methods
PCAP objective 3.3 is employ built-in string methods, and unusually it names them: capitalize, center, count, endswith, find, index, isalnum, isalpha, isdigit, islower, isspace, isupper, join, lower, lstrip, replace, rfind, rstrip, split, startswith, strip, swapcase, title, upper. This page runs every one, then the optional arguments most of them take - because that is where the answers change.
Strings in Depth Guide 11 of 25 Intermediate
- OSUbuntu 26.04 LTS
- Python3.14.4
- pip25.1.1
- TimeAbout 17 min
None of these methods has changed in Python 3. str has 47 public methods in total; the objective names 24 of them, and the extras worth knowing are at the end of this page.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| RUNNER01 | 192.168.0.27 | Ubuntu 26.04 LTS | Python 3.14.4 - the only machine this path needs | 2 Core | 4 GB | 50 GB |
This guide includes
Use this because this objective names its methods explicitly, all twenty-four of them. This matters because the questions turn on their optional arguments, and on find against index - the same search with two different failures.
- running all twenty-four named methods in one go
- using the optional arguments that change every answer
- separating
findfromindexby how each one fails - seeing the is-family on an empty string, and three methods on deliberately awkward input
- confirming that every method returns a new string
Before you start
- guide 17 - immutability, and why every method returns a new string.
- guide 10 - comparison order, for the case methods.
-
The named list, run in one go
-
The optional arguments that change every answer
-
find against index
-
The is-family on an empty string
-
capitalize, title and swapcase on awkward input
-
Every method returns a new string
-
Three more that are useful and are not on the list
-
What the exam does with this objective