Split string by a substring
问题 I have following string: char str[] = "A/USING=B)"; I want to split to get separate A and B values with /USING= as a delimiter How can I do it? I known strtok() but it just split by one character as delimiter. 回答1: I known strtok() but it just split by one character as delimiter Nopes, it's not. As per the man page for strtok)() , ( emphasis mine ) char *strtok(char *str, const char *delim); [...] The delim argument specifies a set of bytes that delimit the tokens in the parsed string. [...]