Created
December 15, 2020 18:19
-
-
Save karakanb/276c2f94c82b04bfe94739d9c8b99a87 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 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