当前位置: 软件>C/C++软件
字符串分割类 StringSpliter
本文导语: 一个强大稳定的字符串分割 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.N...
一个强大稳定的字符串分割 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: %sn", n, sec); }