Example 75: Extract a Substring
Learn how to extract a substring from a string.
We'll cover the following...
Problem
Write a program that extracts a substring from the left, right, or middle of a string.
Example
The following string has been used for the examples given in the table.
String: Four hundred and thirty two
Input | Output |
---|---|
getsub (str, 5, 7) | hundred |
leftsub (str, 4) | Four |
rightsub |
Access this course and 1400+ top-rated courses and projects.