013-001-006
Standard Library: String Class Methods
Medium
Problem Description
Standard Library: String class Methods
In this problem, you will create a program that reads a string, a start index, and an end index from standard input, then calls length(), toUpperCase(), and substring() on the string to retrieve its length, convert it to uppercase, and extract a substring, then displays each result to standard output.
Learning Objective: Learn to use String class methods effectively for efficient string manipulation
Overview
For a string received from standard input, use multiple String class methods to retrieve and process information. Use length(), toUpperCase(), and substring() methods.
Input Format
string
startIndex
endIndex
Specifications
- Get length of the input string
- Convert to all uppercase
- Extract substring from startIndex to endIndex (exclusive)
- Output each result
Output Format
Length: [length]
UpperCase: [uppercase string]
Substring: [extracted substring]
Sample Input/Output
Input:
Hello World
0
5
Output:
Length: 11
UpperCase: HELLO WORLD
Substring: Hello
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up