해결됨
Search for a certain letter in the last line of a text with always different numbers of lines
I am trying to search for a certain letter in the last line of a text with always different numbers of lines. I have already managed the search for the letter, I am only missing the possibility to limit the search to the last line. Sometimes it is only one line and sometimes two or even more.
var t = sourceRectAtTime().top;
var h = sourceRectAtTime().height;
var y = t + h;
var txt = text.sourceText;
var find = txt.includes("p");
if(find == true){[value[0], y-5]} else {[value[0], y]}
I tried it with .split("r")[x]; but I can only select a certain line, which doesn't help if I don't know which one is the last.
var t = sourceRectAtTime().top;
var h = sourceRectAtTime().height;
var y = t + h;
var txt = text.sourceText;
var t1 = txt.split("r")[0];
var t2 = txt.split("r")[1];
var t3 = txt.split("r")[2];
var t4 = txt.split("r")[3];
var find = t2.includes("p");
if(find == true){[value[0], y-5]} else {[value[0], y]}
Thanks for helping me!
