Compare commits

...

31 Commits

Author SHA1 Message Date
Tiago Collot 6d6bb22205 docs(printfirsthalf): instructions upgrade 2 years ago
Tiago Collot 20025f7a91 docs(printfirsthalf): fix subject 2 years ago
zainab Dnaya d235d4a389
Update README.md 2 years ago
zainab Dnaya f2201c5437
Correct a Typo 2 years ago
zainab Dnaya 8ba6b09853
Update README.md 2 years ago
zainab Dnaya 67dfeb17eb
Update README.md 2 years ago
zainab Dnaya 650c6acc1b
Update README.md 2 years ago
zainab Dnaya 3637658b4f
Update README.md 2 years ago
zainabdnaya 6e5350b480 feat: subject of Printfirsthalf 2 years ago
zainabdnaya 151f5c48fe feat: subject of Printfirsthalf 2 years ago
zainab Dnaya 1d15866eed
Update README.md 2 years ago
zainabdnaya 513f68319a feat: subject of Printfirsthalf 2 years ago
zainabdnaya e856b9516a feat: subject of Printfirsthalf 2 years ago
zainabdnaya 6f6b410fbf feat: subject 2 years ago
zainabdnaya 789f9496f9 feat: subject 2 years ago
Hamza elkhatri 8aba27a2ff
Update README.md 2 years ago
Hamza elkhatri 31def6fdb2
Update README.md 2 years ago
Hamza elkhatri 7b104f5e7e
add condition in bonus part 2 years ago
Hamza elkhatri 1856eaa5b0
Update README.md 2 years ago
Hamza elkhatri 3d5c2807bd
Add bonus part 2 years ago
zainabdnaya 3c3f1663a7 feat: Update the audit 2 years ago
zainabdnaya c1818288c8 feat: Update the audir 2 years ago
zainabdnaya 5b05f1e873 Merge branch 'DEV-3228-DEV-3229-web-server-subject' of https://github.com/01-edu/public into DEV-3228-DEV-3229-web-server-subject 2 years ago
zainabdnaya 1f79b2261f Localhost Subject 2 years ago
Hamza elkhatri 6f3c37ef1a
Update README.md 2 years ago
Hamza elkhatri 47628970b2
add condition of http code and redirections 2 years ago
Hamza elkhatri 234e09311e
add cgi condition 2 years ago
Hamza elkhatri a41ec15a3a
Update README.md 2 years ago
Hamza elkhatri 37d29e27cf
add hints && add conditions 2 years ago
hamza 3ab59cd27e fix the name 2 years ago
hamza cb9e085945 add subject for localhost 2 years ago
  1. 45
      subjects/printfirsthalf/README.md

45
subjects/printfirsthalf/README.md

@ -0,0 +1,45 @@
## printfirsthalf
### Instructions
Write a function called `PrintFirstHalf()` that takes a `string` as an argument and prints the first half of a `string` followed by a newline `\n`.
- If the length of the `string` is odd, round it down.
- If the `string` is empty, return `Invalid Output` followed by a newline `\n`.
- If the `string` length is equal to one, return the `string` followed by a newline `\n`.
### Expected function
```go
func PrintFirstHalf(str string) string {
}
```
### Usage
Here is a possible program to test your function:
```go
package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Print(piscine.PrintFirstHalf("This is the 1st halfThis is the 2nd half"))
fmt.Print(piscine.PrintFirstHalf(""))
fmt.Print(piscine.PrintFirstHalf("Hello World"))
}
```
And its output:
```console
$ go run . | cat -e
This is the 1st half$
Invalid Output$
Hello$
```
Loading…
Cancel
Save