Created
December 15, 2020 18:10
-
-
Save karakanb/932198ad2cfe42c3ce8027658172b59a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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