MCPcopy Create free account
hub / github.com/carbonengine/trinity / StringSplit

Function StringSplit

trinity/Utilities/StringUtils.h:44–59  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Split up a string into a vector of strings using a seperator. Similar to Python's split() --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

42// Similar to Python's split()
43// --------------------------------------------------------------------------------
44inline void StringSplit( std::vector<std::string>& result, const char* original, char seperator )
45{
46 std::string originalStr( original );
47 for( size_t i = 0; i < originalStr.size(); ++i )
48 {
49 size_t next = originalStr.find( seperator, i );
50 if( next == std::string::npos )
51 {
52 next = originalStr.size();
53 }
54
55 result.push_back( originalStr.substr( i, next - i ) );
56
57 i = next;
58 }
59}
60
61// --------------------------------------------------------------------------------
62// Description:

Callers 2

SetupMethod · 0.85

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected