stop reading a line on the LF character

Discuss and share scripts and script files...
Post Reply
HugoBil
Posts: 6
Joined: 11 Oct 2020 15:25

stop reading a line on the LF character

Post by HugoBil »

Hello.

Regarding a column customized with the following script, on .md files:

Code: Select all

$a = readfile("<cc_item>");
$b = gettoken("$a", 1, "<crlf>");
return "$b";
… it allows displaying in said column the first line of a plain text file (the characters of the first line, preceding the CRLF carriage return).

An example of the application of this script for .txt files can be found on this page.

But I would like to run a similar script on .md files with LF type line breaks instead of CRFL.

The script not finding a character strictly “CRLF”, all the characters located after “LF” are displayed in the column…

Is it possible to replace the term "<CRLF>" in the script with a term meaning "LF"?

I saw this page but it didn't help me. I don't know script language and am confused about it.

Thanking you for your help.

jupe
Posts: 2757
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: stop reading a line on the LF character

Post by jupe »

Code: Select all

 $a = readfile("<cc_item>");
 $b = gettoken("$a", 1, chr(10));
 return "$b";
Keep in mind that if the first line is blank, you won't get a return without adding more to the script.

HugoBil
Posts: 6
Joined: 11 Oct 2020 15:25

Re: stop reading a line on the LF character

Post by HugoBil »

Thank you. It was so simple :) Also it has the advantage of working for both cases, LF and CRLF…

Post Reply