StreamReader?

jigax

Active member
Joined
Aug 17, 2006
Messages
43
Programming Experience
Beginner
Hello everyone,

How could I have streamwriter write a , terminator for every space?

For example if I have a line that reads "Hello World!"
I would like streamwriter to write Hello , World

Thank you in advance.
 
First up, StreamReaders don't write. As the name suggests, they read. Also, this replacement really has nothing to do with the StreamWriter. It will just write what you tell it to. If you have a starting string and you want to write something different then you must process the string first to get another string, which you can then pass to the StreamWriter. If you want to replace each space with two spaces separated by a comma then that's exactly what you should do:
VB.NET:
myStreamWriter.WriteLine(("Hello World").Replace(" ", " , "))
You can obviously make whatever substitutions you like that way.
 
Thanks so much for your help. Thats exactly what I needed. Sorry I wasn't to clear but what I meant was replace the contest streamreader reads using streamwriter. You understood :)
 
Back
Top