user1695610
user1695610

Reputation: 41

A string feeding a textfieldparser in vb.net

Before I ask I just want to say that I HAVE looked this up, and I just can't figure it out.
So I've got a web call returning an incredibly long string of text that I need to split up. I want to use textfieldparser but I don't want to save this string as a file and textfieldparser seems to be all about files or... streams and I don't understand streams. So how would I feed a string into this? Can I convert it to a stream? I realize this is probably super simple so I apologize for my ignorance.

Thank you very much for your help!

Upvotes: 4

Views: 3930

Answers (1)

igrimpe
igrimpe

Reputation: 1785

Textfieldparser has a constructor that takes a TextReader. Have you tried something like this:

Dim t As New FileIO.TextFieldParser(New System.IO.StringReader("thestringinside"))

You might also look on www.filehelpers.net (have never tried myself, but looks promising - I am in no way affiliated!) because the engine also supports a ReadString method

Upvotes: 11

Related Questions