get an array of indices where a character exists in a string