Generic split function for string in c++