Brunot
Loading...
Searching...
No Matches
StringUtils.h
Go to the documentation of this file.
1
10// ____ __ __ __
11// /\__ _\/\ \ /\ \/\ \
12// \/_/\ \/\ \ \___ __ \ \ \_\ \ ___ __ __ ____ __
13// \ \ \ \ \ _ `\ /'__`\ \ \ _ \ / __`\/\ \/\ \ /',__\ /'__`\
14// \ \ \ \ \ \ \ \/\ __/ \ \ \ \ \/\ \L\ \ \ \_\ \/\__, `\/\ __/
15// \ \_\ \ \_\ \_\ \____\ \ \_\ \_\ \____/\ \____/\/\____/\ \____\
16// \/_/ \/_/\/_/\/____/ \/_/\/_/\/___/ \/___/ \/___/ \/____/
17
18
19#pragma once
20#include <string>
21#include <vector>
22
23// namespace for utility classes and functions
24namespace util
25{
26
33static auto splitString(const std::string& fullString, const std::string& delimiter) -> std::vector<std::string>
34{
35 size_t start = 0;
36 auto end = delimiter.length();
37 auto delimiterLength = delimiter.length();
38 std::string token;
39 std::vector<std::string> result;
40
41 while ((end = fullString.find(delimiter, start)) != std::string::npos)
42 {
43 token = fullString.substr(start, end - start);
44 start = end + delimiterLength;
45 result.push_back(token);
46 }
47
48 result.push_back(fullString.substr(start));
49 return result;
50}
51}
static FMOD_RESULT result
Definition AudioObject.cpp:27
Definition StringUtils.h:25
static auto splitString(const std::string &fullString, const std::string &delimiter) -> std::vector< std::string >
splits a string into many smaller strings.
Definition StringUtils.h:33