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

Method split_floats_mk

core/string/ustring.cpp:1249–1279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1247}
1248
1249Vector<float> String::split_floats_mk(const Vector<String> &p_splitters, bool p_allow_empty) const {
1250 Vector<float> ret;
1251 int from = 0;
1252 int len = length();
1253
1254 String buffer = *this;
1255 while (true) {
1256 int idx;
1257 int end = findmk(p_splitters, from, &idx);
1258 int spl_len = 1;
1259 if (end < 0) {
1260 end = len;
1261 } else {
1262 spl_len = p_splitters[idx].length();
1263 }
1264
1265 if (p_allow_empty || (end > from)) {
1266 buffer[end] = 0;
1267 ret.push_back(String::to_float(&buffer.get_data()[from]));
1268 buffer[end] = _cowdata.get(end);
1269 }
1270
1271 if (end == len) {
1272 break;
1273 }
1274
1275 from = end + spl_len;
1276 }
1277
1278 return ret;
1279}
1280
1281Vector<int> String::split_ints(const String &p_splitter, bool p_allow_empty) const {
1282 Vector<int> ret;

Callers 3

append_textMethod · 0.80
_read_float_arrayMethod · 0.80
test_string.hFile · 0.80

Calls 4

lengthMethod · 0.45
push_backMethod · 0.45
get_dataMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected