一个强大稳定的字符串分割 C++ 类,是对 c_tokenizer 的封装。
示例代码:
char *str = "$PTNL,PJK,102823.80,012613,+3541087.713,N,+1878282.023,E,1,16,0.8,EHT+52.668,M*4F"; StringSpliter string_spliter(str, ","); int n; const char *sec; for (n=0, sec = string_spliter.Next(); sec; sec=string_spliter.Next(), n++) { printf("%2d: %s\n", n, sec); }