How to Delete Blank Spaces
Moderators: Dorian (MJT support), JRL
How to Delete Blank Spaces
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
Now if only I could figure out how to delete all the lines up to where it says "Macro Man".... Check other posts
-
- Junior Coder
- Posts: 24
- Joined: Sun Jun 11, 2006 9:50 am
stringreplace
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)
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:
See the StringReplace function
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
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
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:
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
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Newbie
- Posts: 10
- Joined: Sun Apr 15, 2007 12:02 am
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
StringReplace>string,TAB,,string
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?