Part 3
Substring Length
As you have just learned, Part_btwn() extracts the substring located between two specified positions.
Prt_btwn(firstPsn, lastPsn, whichString);
Using the two positions we can calculate the length of the resulting substring:
|substring| = lastPsn - firstPsn;
Example:
α = <7, 2, 4, 1, 3 >;
β = Prt_btwn (1, 4, α) = <2, 4, 1 >;
| β | = 4 - 1 = 3;
The length of the substring β is 3.
|