MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / get_slicec

Method get_slicec

core/string/ustring.cpp:969–996  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

967}
968
969String String::get_slicec(char32_t p_splitter, int p_slice) const {
970 if (is_empty()) {
971 return String();
972 }
973
974 if (p_slice < 0) {
975 return String();
976 }
977
978 const char32_t *c = ptr();
979 int i = 0;
980 int prev = 0;
981 int count = 0;
982 while (true) {
983 if (c[i] == 0 || c[i] == p_splitter) {
984 if (p_slice == count) {
985 return substr(prev, i - prev);
986 } else if (c[i] == 0) {
987 return String();
988 } else {
989 count++;
990 prev = i + 1;
991 }
992 }
993
994 i++;
995 }
996}
997
998Vector<String> String::split_spaces(int p_maxsplit) const {
999 Vector<String> ret;

Callers 15

_setMethod · 0.80
_getMethod · 0.80
generate_codeMethod · 0.80
_setMethod · 0.80
_getMethod · 0.80
_get_property_listMethod · 0.80
_setMethod · 0.80
_getMethod · 0.80
set_color_regionsMethod · 0.80
_parse_nodeMethod · 0.80
_setMethod · 0.80
_getMethod · 0.80

Calls 1

StringClass · 0.70

Tested by 4

get_stack_variableMethod · 0.64
update_treeMethod · 0.64