Read whole file and parse it for different purpose


#1

Hello all,

I am going to create new package for my BASIC language. In this package I have to read whole BASIC file and need to get first 5 chars of each line. How can I do this ? Any suggestions?

Thanks,
Python UI


#2

You can do the following in javascript/es6 (you need a reference to the text editor containing the code):

textEditor.getText().split('\n').map(line => line.slice(0, 5))

#3

@olmokramer Thanks for answer (I am new to all this)