MCPcopy Create free account
hub / github.com/clechasseur/pathcopycopy / StringToUInt32s

Method StringToUInt32s

PathCopyCopy/src/PluginUtils.cpp:514–532  ·  view source on GitHub ↗

Converts a string containing a list of unsigned integers to a vector. @param p_UInt32sAsString String containing the integers. @param p_Separator Character used to separate the integers in the string. @return Vector of unsigned integers.

Source from the content-addressed store, hash-verified

512 // @return Vector of unsigned integers.
513 //
514 UInt32V PluginUtils::StringToUInt32s(std::wstring p_UInt32sAsString,
515 const wchar_t p_Separator)
516 {
517 // Assume there are no integers.
518 UInt32V vUInt32s;
519
520 // First split the string.
521 WStringV vStringParts = StringUtils::Split(std::move(p_UInt32sAsString), p_Separator);
522
523 // Scan parts and convert to integers.
524 for (const std::wstring& stringPart : vStringParts) {
525 std::wistringstream wis(stringPart.c_str());
526 uint32_t integer = 0;
527 wis >> integer;
528 vUInt32s.push_back(integer);
529 }
530
531 return vUInt32s;
532 }
533
534 //
535 // Converts a list of plugin IDs to a string containing them.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected