toUTFindex

fnsize_t toUTFindex(C)(const(C)[] str, size_t n) if (isSomeChar!C) @safe pure

Given a UCS index n into str, returns the UTF index. So, n is how many code points into the string the code point is, and the array index of the code unit is returned.