First, there are already CSV parsers available and you might want to use, or at least look at, one of those.
Second, your code won’t handle escaped quotes like
Third, what’s probably the slowest part of the code is
str=str+ch. Concatenating strings like this tends to be slow because, each time, a new string is created and the old one destroyed. There are techniques you can use to speed that up such as using an array to “build” the string, then using
String.FromArray to join the characters. (If you didn’t have to worry about escaped characters, you could just track the start and end of each segment and use Middle to extract it.)
Next, if the delimiter is going to be a single byte (as is usually the case when splitting CSV), you can still use a MemoryBlock to scan the string for the delimiter, then use StringValue to extract the segments. This is a more advanced technique though and some are not comfortable with MemoryBlocks.
Lastly, please use code tags when posting code to make it easier on us.