Removing Line based on First Character 
Author Message
 Removing Line based on First Character

Hi,

Does anyone have an idea for removing a line based on the first
character(s)? For example if I have "rem This is a comment in system files"
Then that line would be removed from the string containing it.

Thanks,
Jeff



Sat, 18 Nov 2000 03:00:00 GMT  
 Removing Line based on First Character

Quote:

> Hi,

> Does anyone have an idea for removing a line based on the first
> character(s)? For example if I have "rem This is a comment in system files"
> Then that line would be removed from the string containing it.

Hi,

I guess you read this string from a file.

Read the file line-by-line instead and skip every line which starts with REM

 myString=""
 open"myfile" for input as #1
 while not eof(1)
   line input#1,x
   if ucase(left(x,4))="REM " then
      'skip
   else
      'append
      myString=myString & vbCrLf & x
   endif
 wend
 close#1

HTH

Michaela



Sat, 18 Nov 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Print to File - chops off first character of each line

2. Readline only read first character in line

3. Ignoring Lines Based on First Chars/Word

4. How to remove the first character from each line in a file and output to a new file.

5. Textbox/label which add a new line and remove the last line

6. line input lines greater than 255 characters?

7. Run code on change to first character of combo box

8. Read the first character of a string

9. Help removing a filter and not going to first record

10. 2 Recordset's - 2nd one based the the first

11. Finding position of first character of postal code

12. What syntax for first seven Characters ??

 

 
Powered by phpBB® Forum Software