Parse

The following code deletes everything from position 22 onwards. Could someone please modify it so that it deletes everything from character 16 BACKWARDS and leaves characters 17 to 21 aligned left on the page?

Thanks.

==================================================

Do Until EOF(File1)
   Line Input #File1, strLine 'Read Line by Line
   If Len(Trim(strLine)) > 21 Then
       Print #File2, Left(strLine, 21)
   Else
       Print #File2, strLine
   End If
Loop
muhammasifAsked:
Who is Participating?
 
deightonConnect With a Mentor progCommented:
Do Until EOF(File1)
  Line Input #File1, strLine 'Read Line by Line
  If Len(Trim(strLine)) > 21 Then
      Print #File2, mid(strLine, 17,5)
  End If
Loop
0
 
rspahitzCommented:
print mid$(strLine, 17)

this will print everything starting from character 17 to the end of the string.
0
 
rspahitzCommented:
Oops...yeah...I missed that "stop at char 21" part.  Make sure to add the ",5" as deighton shows.
0
 
ebosscherCommented:
homework?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.