public/subjects/iscapitalized
miguel 7b50c69f22 fix(checkpoints) add imports to the files 2024-02-02 10:10:50 +00:00
..
README.md docs(checkpoints-exercises): remove piscine imports 2023-07-04 15:43:17 +01:00
main.go fix(checkpoints) add imports to the files 2024-02-02 10:10:50 +00:00

README.md

iscapitalized

Instructions

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 any of the words begin with a lowercase letter return false.
  • If the string is empty return false.

Expected function

func IsCapitalized(s string) bool {

}

Usage

Here is a possible program to test your function:

package main

import (
	"fmt"
)

func main() {
	fmt.Println(IsCapitalized("Hello! How are you?"))
	fmt.Println(IsCapitalized("Hello How Are You"))
	fmt.Println(IsCapitalized("Whats 4this 100K?"))
	fmt.Println(IsCapitalized("Whatsthis4"))
	fmt.Println(IsCapitalized("!!!!Whatsthis4"))
	fmt.Println(IsCapitalized(""))
}

And its output:

$ go run .
false
true
true
true
true
false