|
|
@ -15,16 +15,7 @@ This means that: |
|
|
|
|
|
|
|
|
|
|
|
Write a function that returns the nth `rune` of a `string`. |
|
|
|
Write a function that returns the nth `rune` of a `string`. |
|
|
|
|
|
|
|
|
|
|
|
### Expected function |
|
|
|
- In case of impossibilities, the function returns `0`. |
|
|
|
|
|
|
|
|
|
|
|
```go |
|
|
|
|
|
|
|
func NRune(s string, n int) rune { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
### Instructions |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Write a function that returns the nth `rune` of a `string`. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Expected function |
|
|
|
### Expected function |
|
|
|
|
|
|
|
|
|
|
@ -49,6 +40,8 @@ import ( |
|
|
|
func main() { |
|
|
|
func main() { |
|
|
|
z01.PrintRune(piscine.NRune("Hello!", 3)) |
|
|
|
z01.PrintRune(piscine.NRune("Hello!", 3)) |
|
|
|
z01.PrintRune(piscine.NRune("Salut!", 2)) |
|
|
|
z01.PrintRune(piscine.NRune("Salut!", 2)) |
|
|
|
|
|
|
|
z01.PrintRune(piscine.NRune("Bye!", -1)) |
|
|
|
|
|
|
|
z01.PrintRune(piscine.NRune("Bye!", 5)) |
|
|
|
z01.PrintRune(piscine.NRune("Ola!", 4)) |
|
|
|
z01.PrintRune(piscine.NRune("Ola!", 4)) |
|
|
|
z01.PrintRune('\n') |
|
|
|
z01.PrintRune('\n') |
|
|
|
} |
|
|
|
} |
|
|
|