This function is similar to strtok in C. Input sequence is split into tokens, separated by separators. Separators are given by means of the predicate.
Template: split(Result, Input, PredicateT Pred); Parameters: Input: A container which will be searched. Pred: A predicate to identify separators. This predicate is supposed to return true if a given element is a separator. Result: A container that can hold copies of references to the substrings. Returns: A reference the result
Application : It is used to split a string into substrings which are separated by separators.
Input : boost::split(result, input, boost::is_any_of(" ")) input = "geeks for geeks" Output : geeks for geeks Explanation: Here in input string we have "geeks for geeks" and result is a container in which we want to store our result here separator is " ".
geeks for geeks