String:sub()

The sub method on a string allows you to get a substring of the source string provided based on the start and end position you specify.

In the following simple example, you can see “Mr.” is returned.