Skip to content

Instantly share code, notes, and snippets.

@filipearray
Created May 11, 2024 02:08
Show Gist options
  • Save filipearray/b618d39ae156b287b3c8b137321e3943 to your computer and use it in GitHub Desktop.
Save filipearray/b618d39ae156b287b3c8b137321e3943 to your computer and use it in GitHub Desktop.
Welcome To Tech Palace!
package techpalace
import "strings"
// WelcomeMessage returns a welcome message for the customer.
func WelcomeMessage(customer string) string {
return "Welcome to the Tech Palace, " + strings.ToUpper(customer)
panic("Please implement the WelcomeMessage() function")
}
// AddBorder adds a border to a welcome message.
func AddBorder(welcomeMsg string, numStarsPerLine int) string {
return strings.Repeat("*", numStarsPerLine)+ "\n" + welcomeMsg + "\n" + strings.Repeat("*", numStarsPerLine)
panic("Please implement the AddBorder() function")
}
// CleanupMessage cleans up an old marketing message.
func CleanupMessage(oldMsg string) string {
strWithoutStars := strings.Replace(oldMsg, "**************************\n*", "", -1)
strWithoutStars = strings.Replace(strWithoutStars, "*", "", -1)
strWithoutStars = strings.Replace(strWithoutStars, "\n**************************", "", -1)
strWithoutStars = strings.TrimSpace(strWithoutStars)
return strWithoutStars
panic("Please implement the CleanupMessage() function")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment