有人可以解释一下strtok()
和strsep()
有什么区别吗?
它们的优缺点是什么?
我为什么还要选一个呢。
最佳答案
从GNU C库手册-Finding Tokens in a String:
One difference between
strsep
andstrtok_r
is that if the input string contains more than one character from delimiter in a rowstrsep
returns an empty string for each pair of characters from delimiter. This means that a program normally should test forstrsep
returning an empty string before processing it.
关于c - C中的strtok和strsep有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7218625/