mirror of https://github.com/01-edu/public.git
2 changed files with 56 additions and 0 deletions
@ -0,0 +1,29 @@
|
||||
## cleanstr |
||||
|
||||
### Instructions |
||||
|
||||
Write a **program** that takes a `string`, and displays this `string` with exactly: |
||||
- one space between words. |
||||
- without spaces nor tabs at the beginning nor at the end. |
||||
- with the result followed by a newline ("`\n`"). |
||||
|
||||
A "word" is defined as a part of a `string` delimited either by spaces/tabs, or |
||||
by the start/end of the `string`. |
||||
|
||||
If the number of arguments is not 1, or if there are no words to display, the |
||||
program displays a newline ("`\n`"). |
||||
|
||||
### Usage : |
||||
|
||||
```console |
||||
student@ubuntu:~/piscine-go/cleanstr$ go build |
||||
student@ubuntu:~/piscine-go/cleanstr$ ./cleanstr "you see it's easy to display the same thing" | cat -e |
||||
you see it's easy to display the same thing$ |
||||
student@ubuntu:~/piscine-go/cleanstr$ ./cleanstr " only it's harder " |
||||
only it's harder$ |
||||
student@ubuntu:~/piscine-go/cleanstr$ ./cleanstr " how funny" "Did you hear Mathilde ?" |
||||
$ |
||||
student@ubuntu:~/piscine-go/cleanstr$ ./cleanstr "" | cat -e |
||||
$ |
||||
student@ubuntu:~/piscine-go/cleanstr$ |
||||
``` |
@ -0,0 +1,27 @@
|
||||
## cleanstr |
||||
|
||||
### Instructions |
||||
|
||||
Écrire un programme qui prend une `string`, et qui affiche cette `string` avec exactement: |
||||
- un espace entre les mots. |
||||
- aucun espace ni de tabulation ni au début ni à la fin. |
||||
- le résultat avecsuivi d'un saut de ligne("`\n`"). |
||||
|
||||
Un "mot" est défini comme une partie de `string` délimité par soit des espaces/tabulations soit par le début/fin d'une `string`. |
||||
|
||||
Si le nombre d'arguments est différent de 1, ou si il n'y a pas de mots à afficher, alors le programme affiche un saut de ligne("`\n`"). |
||||
|
||||
### Utilisation : |
||||
|
||||
```console |
||||
student@ubuntu:~/piscine-go/cleanstr$ go build |
||||
student@ubuntu:~/piscine-go/cleanstr$ ./cleanstr "you see it's easy to display the same thing" | cat -e |
||||
you see it's easy to display the same thing$ |
||||
student@ubuntu:~/piscine-go/cleanstr$ ./cleanstr " only it's harder " |
||||
only it's harder$ |
||||
student@ubuntu:~/piscine-go/cleanstr$ ./cleanstr " how funny" "Did you hear Mathilde ?" |
||||
$ |
||||
student@ubuntu:~/piscine-go/cleanstr$ ./cleanstr "" | cat -e |
||||
$ |
||||
student@ubuntu:~/piscine-go/cleanstr$ |
||||
``` |
Loading…
Reference in new issue