elemIndices package:hledger

The elemIndices function extends elemIndex, by returning the indices of all elements equal to the query element, in ascending order.
>>> elemIndices 'o' "Hello World"
[4,7]