Page 1 of 1

stop reading a line on the LF character

Posted: 23 Jan 2022 20:52
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.

Re: stop reading a line on the LF character

Posted: 23 Jan 2022 21:23
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.

Re: stop reading a line on the LF character

Posted: 24 Jan 2022 18:08
by HugoBil
Thank you. It was so simple :) Also it has the advantage of working for both cases, LF and CRLF…