Skip to content

Instantly share code, notes, and snippets.

@karakanb
Created December 15, 2020 18:10
Show Gist options
  • Save karakanb/932198ad2cfe42c3ce8027658172b59a to your computer and use it in GitHub Desktop.
Save karakanb/932198ad2cfe42c3ce8027658172b59a to your computer and use it in GitHub Desktop.
func parseWithStringManipulation(inputString string) int {
isAm := strings.HasSuffix(inputString, "AM")
number, _ := strconv.Atoi(inputString[:len(inputString) - 2])
if !isAm {
number += 12
}
return number
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment