How to use boost split to split a string and ignore empty values?

前端 未结 3 1705
遇见更好的自我
遇见更好的自我 2021-02-04 02:55

I am using boost::split to parse a data file. The data file contains lines such as the following.

data.txt

1:1~15  ASTKGPSVFPLAPSS SVFPLAPSS   -12.6   98         


        
3条回答
  •  醉梦人生
    2021-02-04 03:47

    Leading and trailing whitespace is intentionally left alone by boost::split because it does not know if it is significant or not. The solution is to use boost::trim before calling boost::split.

    #include 
    
    ....
    
    boost::trim(buf);
    

提交回复
热议问题