Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5339

scan from string with delimiters

$
0
0

I want to scan a string which is made from a fixed number of strings comma separated.

For example

source string = str1,str2,str3,str4

I want to extract the four strings "str1", "str2", "str3" and "str4".

 

The problem is that one (or more of the strings) can be empty.

For example

source string = str1,str2,,str4

I want to extract the four strings "str1, "str2", "" (i.e. empty string), "str4"

All the functions I tested (sscanf, Scan , strtok) handle multiple occurrences of delimiter as single occurrence and so I get

"str1", "str2", "str3

 

Which function can I use?


Viewing all articles
Browse latest Browse all 5339

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>