Start here · Essential guide
How to Split a String by a Delimiter in C++
C++ has no built-in split() for strings. Learn how to split a string by a delimiter with getline, find and substr, and std::views::split, with examples.
Strings, Containers and Memory
How to split a string on a delimiter in C++, compared with split() in C# and Python.
Start here · Essential guide
C++ has no built-in split() for strings. Learn how to split a string by a delimiter with getline, find and substr, and std::views::split, with examples.
Split a string on a delimiter in C++ with getline for one character, or find_first_of for any of several. It also shows how empty pieces are kept or dropped.
In Python, str.split() breaks a string into a list at each delimiter. Learn the separator, maxsplit and empty-piece rules, with examples and a C++ comparison.
C++ has no split() function. Here is how to get the same result with getline, what split() does in other languages, and where to find Boost's split function.
In C#, string.Split() returns an array of the pieces between delimiters. See the char and options overloads, empty entries, and how it compares to C++.
Related topics