Swift: avoid intermediate Range<Int> in String extensions