MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / substr

Method substr

modules/gui/gui/src/backend/text_server/ustring.cpp:3427–3452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3425}
3426
3427String String::substr(int p_from, int p_chars) const
3428{
3429 if (p_chars == -1)
3430 {
3431 p_chars = length() - p_from;
3432 }
3433
3434 if (is_empty() || p_from < 0 || p_from >= length() || p_chars <= 0)
3435 {
3436 return "";
3437 }
3438
3439 if ((p_from + p_chars) > length())
3440 {
3441 p_chars = length() - p_from;
3442 }
3443
3444 if (p_from == 0 && p_chars >= length())
3445 {
3446 return String(*this);
3447 }
3448
3449 String s;
3450 s.copy_from_unchecked(&get_data()[p_from], p_chars);
3451 return s;
3452}
3453
3454int String::find(const String& p_str, int p_from) const
3455{

Callers 15

splitFunction · 0.45
make_queryMethod · 0.45
splitFunction · 0.45
skr_lua_logFunction · 0.45
parse_urlMethod · 0.45
to_intMethod · 0.45
_countMethod · 0.45
simplify_pathMethod · 0.45

Calls 5

copy_from_uncheckedMethod · 0.80
StringClass · 0.70
lengthFunction · 0.50
is_emptyFunction · 0.50
get_dataFunction · 0.50

Tested by

no test coverage detected