I need this simple split
Item one, Item2, Item no. 3,Item 4
>
Item one
Item2
Item no.3
Item 4
- I know I can use
%*[, ]
format in scanf to ignore comma and spaces, but this is not accurate: the separator should be exactly one comma optionally followed by spaces. - I think I can't use strtok either, since space alone is not a delimiter.
Do I really need regex here, or is there any effective short way to encode this?