Skip to content

Instantly share code, notes, and snippets.

@karakanb
Created December 15, 2020 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karakanb/276c2f94c82b04bfe94739d9c8b99a87 to your computer and use it in GitHub Desktop.
Save karakanb/276c2f94c82b04bfe94739d9c8b99a87 to your computer and use it in GitHub Desktop.
func parseWithStringManipulationWithoutHasSuffix(inputString string) int {
isAm := inputString[len(inputString)-2] == 'A'
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