I have the following string:
absoloute-power
As you can see, there is a "-" at position number 10 in the string. How do I write the go code to validate if the 10th position of any given string has a "-" in the string?
I have the following string:
absoloute-power
As you can see, there is a "-" at position number 10 in the string. How do I write the go code to validate if the 10th position of any given string has a "-" in the string?
You could use a rune-array:
text := "ifthisisyourstring"
chars := []rune(text)
if chars[0] == '1' {
// is true
}