Proper use of str-index