diff options
author | crupest <crupest@outlook.com> | 2021-10-22 21:42:45 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-10-22 21:42:45 +0800 |
commit | 3e84cf013b31c52405a76b8e8778a5991d096290 (patch) | |
tree | 4d3b2d2ef5a9625c55f798d88281073e806ee83f /src/common/String.cpp | |
parent | ed640ca9e3c7482856a0248ea38adafc86a7d4c8 (diff) | |
download | cru-3e84cf013b31c52405a76b8e8778a5991d096290.tar.gz cru-3e84cf013b31c52405a76b8e8778a5991d096290.tar.bz2 cru-3e84cf013b31c52405a76b8e8778a5991d096290.zip |
...
Diffstat (limited to 'src/common/String.cpp')
-rw-r--r-- | src/common/String.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/String.cpp b/src/common/String.cpp index 30f83174..65d303fb 100644 --- a/src/common/String.cpp +++ b/src/common/String.cpp @@ -214,11 +214,11 @@ std::string String::ToUtf8() const { Index String::IndexFromCodeUnitToCodePoint(Index code_unit_index) const { auto iter = CodePointIterator(); Index result = 0; - while (iter.GetPosition() <= code_unit_index && !iter.IsPastEnd()) { + while (iter.GetPosition() < code_unit_index && !iter.IsPastEnd()) { ++iter; ++result; } - return result - 1; + return result; } Index String::IndexFromCodePointToCodeUnit(Index code_point_index) const { |