Reverse String

Published on 12 April 2018 (Updated: 25 July 2024)

Welcome to the Reverse String 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

While Hello World is simple, it often does not show off many interesting features of a language. Fortunately, this repository shares more samples than Hello World. One of these more complex programs is known as Reverse a String.

In this repository, the algorithm must reverse ASCII strings. Do NOT worry about reversing a string in the general case. For instance, if a string contains surrogate pairs, it's okay if the solution corrupts the string during reversal.

Requirements

Despite the explicit name, there are some rules in place for consistency. When writing a Reverse a String program, the following rules should apply:

  1. The implementation must be executable
  2. The string to be reversed must come from the command line
  3. The program must verify the strings existence on the command line
  4. The user must not import libraries to obfuscate the string manipulation

In other words, the program should get a string from the command line and reverse it using language utilities only. Acceptable language utilities include language features and built-in libraries.

External dependencies are unacceptable. Remember, the goal is to show off language features and utilities.

Testing

Every project in the Sample Programs repo should be tested. In this section, we specify the set of tests specific to Reverse String.

Reverse String Tests

Description Input Output
No Input   ""
Empty Input "" ""
Ascii String "Hello, World" "dlroW ,olleH"

Articles

There are 45 articles: