LCD Scroll Code??

I am fairly new to programming. I came across this code, I
managed to comprehend the scroll right portion. with the
exception of " i = strlen(str1); " . which I realized does not
affecting the scroll right function. When it came to the scroll
to the left function I have slight understanding of what is
happening; but I cannot fully understand the purpose of
these lines of codes " i = 40 - strlen(str1); " and " line = line - 1; "
other than the fact that without them the program doesn’t run
like it was intended to. Please feel free to explain it all to me!!

I’ve attached the full code.

LcdScroll.ino (1.24 KB)

Re-inventing the wheel?

https://www.arduino.cc/en/Reference/LiquidCrystal

Trying to stand on the shoulders of giants... ;)

now I remember... it scrolls both top and bottom row of the lcd. The code I found you have the ability to scroll both rows individually. any suggestions?