Kodewick
Start learning →
Starter←0 / 70

Gift card code

#070StarterStrings2 min

The bookshop's gift card codes all start with a capital GIFT-. Write IsGiftCode(code) to return true for a gift card code and false otherwise. The starter already trims the spaces at both ends; case matters, so gift-1 doesn't count.

Examples
IsGiftCode("GIFT-2024")→True
IsGiftCode(" GIFT-77 ")→True
IsGiftCode("SALE-5")→False
The functionfunc IsGiftCode(code string) bool
main.go
package main

import "strings"

func IsGiftCode(code string) bool {
	code = strings.TrimSpace(code)
	// your code here: return whether code starts with "GIFT-"
	return false
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.