Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
stbede77
- Newbie
- Posts: 18
- Joined: Wed Oct 25, 2006 7:04 pm
Post
by stbede77 » Mon Dec 18, 2006 7:05 pm
I have spent the last couple hours looking for a way to delete blank spaces in a .text file... well to say the least there seems to be a couple people also looking for the answer. After a good couple hours looking around I found this simple kcikass program.
http://www.delphiforfun.org/Programs/Ut ... kLines.htm
Now if only I could figure out how to delete all the lines up to where it says "Macro Man".... Check other posts

-
mileswilliams
- Junior Coder
- Posts: 24
- Joined: Sun Jun 11, 2006 9:50 am
Post
by mileswilliams » Sat Dec 23, 2006 1:42 am
I'm sure that there is a vb command that will do this.
Something along the lines of stringreplace.
then you simply replace" " ( a space) with "" (nothing)
don't be a chicken little
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Sat Dec 23, 2006 10:28 pm
See the StringReplace function
-
stbede77
- Newbie
- Posts: 18
- Joined: Wed Oct 25, 2006 7:04 pm
Post
by stbede77 » Wed Mar 21, 2007 7:31 am
Okay I came back to this because I was writing another macro and just found a really simple solution... One that I have yet to see on the forums. And no... you dont have to use vb and you dont have to use the stupid StringReplace command just do.
Let>file=C:\File.txt
Let>workFile=C:\Temp.txt
Let>k=0
Label>start
Let>k=k+1
ReadLn>file,k,line
If>line=##EOF##,FileDone
Lenth>line,BlankLineCheck
If>BlankLineCheck=0
GOTO>start
ELSE
Endif
WriteLn>workFile,res,line
Goto>start
Label>FileDone
Message>Done with removing blank lines
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Wed Mar 21, 2007 7:50 am
StringReplace is not stupid. Your script removes blank lines. Blank lines are different to spaces. You originally asked about removing spaces, in which case StringReplace would have been easiest. Turns out you just wanted to remove blank lines, in which case Length is simplest, as you have discovered. Please don't blame a command for being stupid just because you failed to describe your requirements properly. It might hurt its feelings

-
stbede77
- Newbie
- Posts: 18
- Joined: Wed Oct 25, 2006 7:04 pm
Post
by stbede77 » Wed Mar 21, 2007 8:18 am
lol... okay okay... your right... sorry Mr.StringReplace you are very useful... thank you for all the hard work you have done. Now here is 8 Bits to munch on. *Pat Pat*
-
billy_bragg
- Newbie
- Posts: 10
- Joined: Sun Apr 15, 2007 12:02 am
Post
by billy_bragg » Sun Apr 15, 2007 12:49 am
(*Pat Pat* has 9 bits... you might have to eliminate the space to make it 8...)
-
daniel
- Junior Coder
- Posts: 32
- Joined: Mon Apr 25, 2005 5:04 pm
Post
by daniel » Wed Apr 25, 2007 6:44 pm
One question to add to this. How do I replace a tab, instead of a space, with nothing?
thanks in advance.
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Wed Apr 25, 2007 7:32 pm
StringReplace>string,TAB,,string