Capitalize

Published on 31 March 2019 (Updated: 18 January 2024)

Welcome to the Capitalize page! Here, you'll find a description of the project as well as a list of sample programs written in various languages.

This article was written by:

Description

This simple program picks a string and return the first letter of it in uppercase.

Requirements

For this sample program, each solution should return the string with the first letter in uppercase. For example, the following code should return "Capitalize":

$ ./capitalize.lang "capitalize"
Capitalize

Here are some additional examples:

string -> String
react -> React
java -> Java
car -> Car
a long string term -> A long string term

In addition, there should be some error handling for situations where the user doesn't input a string.

Testing

Every project in the Sample Programs repo should be tested. In this section, we specify the set of tests specific to Capitalize. In order to keep things simple, we split up the testing as follows:

Capitalize Valid Tests

Description Input Output
Sample Input: Lowercase String "hello" "Hello"
Sample Input: Uppercase String "Hello" "Hello"
Sample Input: Long String "hello world" "Hello world"
Sample Input: Mixed Casing "heLLo World" "HeLLo World"
Sample Input: Symbols "12345" "12345"

Capitalize Invalid Tests

Description Input
No Input  
Empty Input ""

All of these tests should output the following:

Usage: please provide a string

Articles