Created
December 31, 2019 05:54
-
-
Save wesinator/27221e5f6b6f96205afca5673bf4ee48 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
import "strings" | |
// return index of second to last occurrence of char in string | |
func SecondToLast(str string, char string) int { | |
return strings.LastIndex(str[0:strings.LastIndex(str, char)], char) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment