Browse Source

docs(iscapitalized): fix subject

- fix exercise title
- upgrade instructions
- add missing import 'piscine'
- fix white-spaces and indentation
DEV-3384-new-go-exercise-is-capitalaze
Tiago Collot 2 years ago
parent
commit
15526c71fc
  1. 31
      subjects/iscapitalize/README.md

31
subjects/iscapitalize/README.md

@ -1,37 +1,42 @@
## is-Capitalize ## iscapitalized
### Instructions ### Instructions
- Write a function `IsCapitalize` that takes a string and returns `true` if each word in the string begins with an uppercase letter, otherwise, and returns `false`. except for the word that begins with non-alphanumerical characters. Write a function `IsCapitalized` that takes a `string` as an argument and returns `true` if each word in the `string` begins with either an uppercase letter or a non-alphabetic character.
- If the string is empty, return `false`.
- If any of the words begin with a lowercase letter return `false`.
- If the `string` is empty return `false`.
### Expected function ### Expected function
```go ```go
func IsCapitalize(s string) bool { func IsCapitalized(s string) bool {
} }
``` ```
### Usage ### Usage
Here is a possible program to test your function : Here is a possible program to test your function:
```go ```go
package main package main
import ( import (
"fmt" "fmt"
"piscine"
) )
func main() { func main() {
fmt.Println(IsAlpha("Hello! How are you?")) fmt.Println(piscine.IsCapitalized("Hello! How are you?"))
fmt.Println(IsAlpha("Hello How Are You")) fmt.Println(piscine.IsCapitalized("Hello How Are You"))
fmt.Println(IsAlpha("Whats 4this 100K?")) fmt.Println(piscine.IsCapitalized("Whats 4this 100K?"))
fmt.Println(IsAlpha("Whatsthis4")) fmt.Println(piscine.IsCapitalized("Whatsthis4"))
fmt.Println(piscine.IsCapitalized("!!!!Whatsthis4"))
fmt.Println(piscine.IsCapitalized(""))
} }
``` ```
And its output : And its output:
```console ```console
$ go run . $ go run .
@ -39,4 +44,6 @@ false
true true
true true
true true
``` true
false
```

Loading…
Cancel
Save