test and resources check quest 05

This commit is contained in:
lee 2021-06-07 18:05:53 +01:00
parent 5c534dc386
commit 907fcfa3ae
18 changed files with 64 additions and 16 deletions

View File

@ -3,7 +3,8 @@
### Instructions
Write a function that counts only the letters of a `string` and that returns that count.
White spaces or any other characters should not be counted.
- White spaces or any other characters should not be counted.
The letters are only the ones from the latin alphabet.

View File

@ -2,7 +2,7 @@
### Instructions
Write a function that takes a `string` number and its `string` base in parameters and returns its conversion as an `int`.
Write a function that takes a `string` number and its `string` base as parameters and returns its conversion as an `int`.
If the base is not valid it returns `0`.

View File

@ -37,3 +37,7 @@ $ go run .
Hello! How are you?
$
```
### Notions
- [string concatenation](https://golang.org/ref/spec#Arithmetic_operators)

View File

@ -2,7 +2,7 @@
### Instructions
Write a function that capitalizes the first letter of each word **and** lowercases the rest of each word of a `string`.
Write a function that capitalizes the first letter of each word **and** lowercases the rest.
A word is a sequence of **alphanumerical** characters.

View File

@ -2,7 +2,7 @@
### Instructions
Write a function that behaves like the [`Compare`](https://golang.org/pkg/strings/#Compare) function.
Write a function that behaves like the `Compare` function.
### Expected function
@ -40,3 +40,7 @@ $ go run .
1
$
```
### Notions
- [strings/Compare](https://golang.org/pkg/strings/#Compare)

View File

@ -40,3 +40,7 @@ $ go run .
HSO
$
```
### Notions
- [rune-literals](https://golang.org/ref/spec#Rune_literals)

View File

@ -2,7 +2,7 @@
### Instructions
Write a function that behaves like the [`Index`](https://golang.org/pkg/strings/#Index) function.
Write a function that behaves like the `Index` function.
### Expected function
@ -40,3 +40,7 @@ $ go run .
-1
$
```
### Notions
- [strings/Index](https://golang.org/pkg/strings/#Index)

View File

@ -2,7 +2,7 @@
### Instructions
Write a function that returns `true` if the `string` passed in parameter only contains alphanumerical characters or is empty, and that returns `false` otherwise.
Write a function that returns `true` if the `string` passed in parameter only contains alphanumerical characters or is empty, and returns `false` otherwise.
### Expected function

View File

@ -2,7 +2,7 @@
### Instructions
Write a function that returns `true` if the `string` passed in parameter only contains numerical characters, and that returns `false` otherwise.
Write a function that returns `true` if the `string` passed in parameter only contains numerical characters, and returns `false` otherwise.
### Expected function

View File

@ -2,7 +2,7 @@
### Instructions
Write a function that returns `true` if the `string` passed in parameter only contains printable characters, and that returns `false` otherwise.
Write a function that returns `true` if the `string` passed in parameter only contains printable characters, and returns `false` otherwise.
### Expected function

View File

@ -2,7 +2,7 @@
### Instructions
Write a function that returns the concatenation of all the `string` of a slice of `string` **separated** by the separator passed in argument.
Write a function that simulates the behaviour of the `Join` function in Go. This function returns the concatenation of all the strings of a slice of strings **separated** by a separator passed in argument.
### Expected function
@ -37,3 +37,7 @@ $ go run .
Hello!: How: are: you?
$
```
### Notions
- [strings/Join](https://golang.org/pkg/strings/#Join)

View File

@ -40,3 +40,7 @@ $ go run .
!!!
$
```
### Notions
- [rune-literals](https://golang.org/ref/spec#Rune_literals)

View File

@ -44,3 +44,7 @@ $ go run .
la!
$
```
### Notions
- [rune-literals](https://golang.org/ref/spec#Rune_literals)

View File

@ -2,7 +2,7 @@
### Instructions
Write a function that prints an `int` in a `string` base passed in parameters.
Write a function that prints an `int` in a `string` base passed as parameters.
If the base is not valid, the function prints `NV` (Not Valid):
@ -62,3 +62,7 @@ $ go run .
NV
$
```
### Notions
- [01-edu/z01](https://github.com/01-edu/z01)

View File

@ -37,3 +37,8 @@ $ go run . | cat -e
1230123$
$
```
### Notions
- [01-edu/z01](https://github.com/01-edu/z01)
- [rune-literals](https://golang.org/ref/spec#Rune_literals)

View File

@ -2,7 +2,7 @@
### Instructions
Write a function that lowercases each letter of `string`.
Write a function that lower cases each letter of a `string`.
### Expected function
@ -36,3 +36,7 @@ $ go run .
hello! how are you?
$
```
### Notions
- [strings/ToLower](https://golang.org/pkg/strings/#ToLower)

View File

@ -2,7 +2,7 @@
### Instructions
Write a function that capitalizes each letter of `string`.
Write a function that capitalizes each letter of a `string`.
### Expected function
@ -36,3 +36,7 @@ $ go run .
HELLO! HOW ARE YOU?
$
```
### Notions
- [strings/ToUpper](https://golang.org/pkg/strings/#ToUpper)

View File

@ -2,13 +2,13 @@
### Instructions
- Write a function that transforms a number within a `string` in a number represented as an `int`.
- Write a function that transforms a number within a `string`, in a number represented as an `int`.
- For this exercise the handling of the signs + or - **has** to be taken into account. If one of the signs is encountered before any number it should determine the sign of the returned `int`.
- For this exercise the handling of the sign `-` **has** to be taken into account. If the sign is encountered before any number it should determine the sign of the returned `int`.
- This function will **only** have to return the `int`. In case of invalid input, the function should return `0`.
- This function will **only** return an `int`. In case of invalid input, the function should return `0`.
- Note: There will never be more than one sign by string in the tests.
- **Note**: There will never be more than one sign by `string` in the tests.
### Expected function
@ -38,6 +38,7 @@ func main() {
fmt.Println(piscine.TrimAtoi("sd+x1fa2W3s4"))
fmt.Println(piscine.TrimAtoi("sd-x1fa2W3s4"))
fmt.Println(piscine.TrimAtoi("sdx1-fa2W3s4"))
fmt.Println(piscine.TrimAtoi("sdx1+fa2W3s4"))
}
```
@ -52,5 +53,6 @@ $ go run .
1234
-1234
1234
1234
$
```