MCPcopy Create free account
hub / github.com/axmolengine/axmol / internalUTF8MoveRight

Function internalUTF8MoveRight

core/ui/UITextFieldEx.cpp:195–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195static std::string internalUTF8MoveRight(std::string_view utf8Text, int length /* default utf8Text.length() */)
196{
197 if (!utf8Text.empty() && length >= 0)
198 {
199
200 // get the delete byte number
201 size_t addLen = 1; // default, erase 1 byte
202
203 while ((length + addLen) < utf8Text.size() && 0x80 == (0xC0 & utf8Text.at(length + addLen)))
204 {
205 ++addLen;
206 }
207
208 return std::string{utf8Text.data(), static_cast<size_t>(length + addLen)};
209 }
210 else
211 {
212 return std::string{utf8Text};
213 }
214}
215
216//////////////////////////////////////////////////////////////////////////
217// constructor and destructor

Callers 1

__moveCursorMethod · 0.85

Calls 4

emptyMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected