java-exercism-exercises/squeaky-clean
Giacomo R. c038195ed5 Aggiunti alcuni esercizi di java. 2023-03-08 19:03:27 +01:00
..
.exercism Aggiunti alcuni esercizi di java. 2023-03-08 19:03:27 +01:00
.gradle Aggiunti alcuni esercizi di java. 2023-03-08 19:03:27 +01:00
.idea Aggiunti alcuni esercizi di java. 2023-03-08 19:03:27 +01:00
build Aggiunti alcuni esercizi di java. 2023-03-08 19:03:27 +01:00
gradle/wrapper Aggiunti alcuni esercizi di java. 2023-03-08 19:03:27 +01:00
src Aggiunti alcuni esercizi di java. 2023-03-08 19:03:27 +01:00
HELP.md Aggiunti alcuni esercizi di java. 2023-03-08 19:03:27 +01:00
HINTS.md Aggiunti alcuni esercizi di java. 2023-03-08 19:03:27 +01:00
README.md Aggiunti alcuni esercizi di java. 2023-03-08 19:03:27 +01:00
build.gradle Aggiunti alcuni esercizi di java. 2023-03-08 19:03:27 +01:00
gradlew Aggiunti alcuni esercizi di java. 2023-03-08 19:03:27 +01:00
gradlew.bat Aggiunti alcuni esercizi di java. 2023-03-08 19:03:27 +01:00

README.md

Squeaky Clean

Welcome to Squeaky Clean on Exercism's Java Track. If you need help running the tests or submitting your code, check out HELP.md. If you get stuck on the exercise, check out HINTS.md, but try and solve it without using those first :)

Introduction

The Java char type represents the smallest addressable components of text. Multiple chars can comprise a string such as "word" or chars can be processed independently. Their literals have single quotes e.g. 'A'.

Java chars support Unicode encoding so in addition to the Latin character set pretty much all the writing systems in use worldwide can be represented, e.g. the Greek letter 'β'.

There are many builtin library methods to inspect and manipulate chars. These can be found as static methods of the java.lang.Character class.

chars are sometimes used in conjunction with a StringBuilder object. This object has methods that allow a string to be constructed character by character and manipulated. At the end of the process toString can be called on it to output a complete string.

Instructions

In this exercise you will implement a partial set of utility routines to help a developer clean up SqueakyClean names.

In the 4 tasks you will gradually build up the clean method. A valid SqueakyClean name is comprised of zero or more letters and underscores.

In all cases the input string is guaranteed to be non-null. Note that the clean method should treat an empty string as valid.

1. Replace any spaces encountered with underscores

Implement the (static) SqueakyClean.clean() method to replace any spaces with underscores. This also applies to leading and trailing spaces.

SqueakyClean.clean("my   Id");
// => "my___Id"

2. Replace control characters with the upper case string "CTRL"

Modify the (static) SqueakyClean.clean() method to replace control characters with the upper case string "CTRL".

SqueakyClean.clean("my\0Id");
// => "myCTRLId",

3. Convert kebab-case to camelCase

Modify the (static) SqueakyClean.clean() method to convert kebab-case to camelCase.

SqueakyClean.clean("à-ḃç");
// => "àḂç"

4. Omit characters that are not letters

Modify the (static) SqueakyClean.clean() method to omit any characters that are not letters.

SqueakyClean.clean("a1😀2😀3😀b");
// => "ab"

5. Omit Greek lower case letters

Modify the (static) SqueakyClean.clean() method to omit any Greek letters in the range 'α' to 'ω'.

SqueakyClean.clean("MyΟβιεγτFinder");
// => "MyΟFinder"

Source

Created by

  • @ystromm