Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: CrAz3D on December 31, 2003, 07:12 PM

Title: Multi-Lined string
Post by: CrAz3D on December 31, 2003, 07:12 PM
vb6

This is my string:


bob OP
cheese OS
2xx-craz3d MOSXLEIP
me OF

It has a blank line @ the top as you can see.  How would I remove this blank line, any ideas?

I tried Replace(string, " ", "word") but then realized that there are other spaces that need to stay.
Title: Re:Multi-Lined string
Post by: hismajesty on December 31, 2003, 07:15 PM
Open the text file, move your cursor to the line that's blank, hit 'del'
Title: Re:Multi-Lined string
Post by: Grok on December 31, 2003, 11:53 PM
If it is a blank line, and not one with a space ...

Buffer = Replace(buffer, vbCrlf & vbCrlf, vbCrlf)
Title: Re:Multi-Lined string
Post by: CrAz3D on January 01, 2004, 10:09 AM
OOh, thank you.
I also got this from CupHead:
While Left(UserList, 2) = vbCrLf
                                   UserList = Right(UserList, Len(UserList) - 2)
                               Wend
Title: Re:Multi-Lined string
Post by: Grok on January 01, 2004, 10:36 AM
Quote from: CrAz3D on January 01, 2004, 10:09 AM
OOh, thank you.
I also got this from CupHead:
While Left(UserList, 2) = vbCrLf
                                   UserList = Right(UserList, Len(UserList) - 2)
                               Wend


His loop is better because it gets rid of all blank lines, where the single replace gets rid of only scattered instances.
Title: Re:Multi-Lined string
Post by: CrAz3D on January 01, 2004, 01:47 PM
Ok, thank you