MCPcopy Create free account
hub / github.com/buggins/coolreader / limitStringSize

Function limitStringSize

crengine/src/lvstring.cpp:4044–4058  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4042}
4043
4044void limitStringSize(lString16 & str, int maxSize) {
4045 if ((int) str.length() < maxSize)
4046 return;
4047 int lastSpace = -1;
4048 for (int i = str.length() - 1; i > 0; i--)
4049 if (str[i] == ' ') {
4050 while (i > 0 && str[i - 1] == ' ')
4051 i--;
4052 lastSpace = i;
4053 break;
4054 }
4055 int split = lastSpace > 0 ? lastSpace : maxSize;
4056 str = str.substr(0, split);
4057 str += L"...";
4058}
4059

Callers 1

getBookmarkPosTextMethod · 0.85

Calls 2

lengthMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected