I am doing a C++ coding exercise, as usual…. And to split a string in C++, the best/easy way is to use the boost library… However, this is not supported on leetcode online judge…
C++ without boost library, is a bit hard to learn and use.
How to Split a String by Delimiter in C++ using Boost Library?
Take this for example, you can easily use boost::split to split a string into vector of string by a set of delimiters, like this:
#include <boost/algorithm/string.hpp>
vector<string> str;
boost::split(str, "string to , split", boost::is_any_of(" ,"));
This is straightforward and easy to use, similar to other modern programming languages. I hope the boost library can be used by the leetcode and also other online judges e.g. Timus. As it brings conveniences and avoids re-inventing the wheel. It allows us to focus on solving the puzzles. However, this can be disabled for coding exercises related to e.g. implementing the string split function.
Leetcode Coding
- How to do Leetcoding on LG OLED Smart TV (65 inch)?
- Leetcode Online Judge Does Not Support Boost Library for C++ Solutions
- Leetcode's Online Code Debugger and Intelligent Code Completion
- How to use the Leetcode's Mock Interview Overview to Nail Your Interview?
- Using the stdout to debug print the solution in the leetcode contest
- ChatGPT Gives a Correct Leetcode Solution (Rust: Binary Search Algorithm) after Several Attempts
- Leetcode DCC Winner T-shirt
- Leetcode's Coding Room - Real time Coding Collaboration (Coding Interview)
–EOF (The Ultimate Computing & Technology Blog) —
323 wordsLast Post: How to Check Any String is Palindrome from Its Permutation?
Next Post: C++ Coding Exercise - Subdomain Visit Count

