int (@NotNull CharSequence charSequence, int charOffset) { if (charOffset <= 0) { return 0; } int result = 0; int i = 0; while (i < charOffset) { result += UTF8Encoding.INSTANCE.codeToMbcLength(charSequence.charAt(i)); i++; } return result; }