MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / Split

Method Split

src/Nazara/Core/String.cpp:3528–3558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3526 */
3527
3528 unsigned int String::Split(std::vector<String>& result, char separation, std::intmax_t start, UInt32 flags) const
3529 {
3530 if (separation == '\0' || m_sharedString->size == 0)
3531 return 0;
3532
3533 std::size_t lastSep = Find(separation, start, flags);
3534 if (lastSep == npos)
3535 {
3536 result.push_back(*this);
3537 return 1;
3538 }
3539 else if (lastSep != 0)
3540 result.push_back(SubString(0, lastSep-1));
3541
3542 for (;;)
3543 {
3544 std::size_t sep = Find(separation, lastSep+1, flags);
3545 if (sep == npos)
3546 break;
3547
3548 if (sep-lastSep > 1)
3549 result.push_back(SubString(lastSep+1, sep-1));
3550
3551 lastSep = sep;
3552 }
3553
3554 if (lastSep != m_sharedString->size-1)
3555 result.push_back(SubString(lastSep+1));
3556
3557 return result.size();
3558 }
3559
3560 /*!
3561 * \brief Splits the string into others

Callers 3

SetShaderMethod · 0.80
LoadExtensionsStringFunction · 0.80
AbsolutePathMethod · 0.80

Calls 2

push_backMethod · 0.80
StringClass · 0.50

Tested by

no test coverage detected