Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get width of last line in a paragraph of text

Tags:

Is it possible to somehow measure the length of the last line of text in a paragraph that has multiple breaks / returns?

          Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
          Donec id elit non mi porta gravida at eget metus. Nulla vitae
          elit libero, a pharetra augue. Nullam id dolor id nibh
          ultricies vehicula ut id elit. Vivamus sagittis lacus vel
[here] ->|augue laoreet rutrum faucibus dolor auctor.|<- [to here]

Note: There are no manual breaks in the text. It is a single line of text wrapped inside, let's say, a <p></p> tag.