Getting the last digit of a number

I do this arcane thing to get the last digit of an integer, which seems a bit… long. Is there an easier way that I’ve missed?

{% set num_last = number | as_str | split(pat="") | slice(start=-2, end=-1) | join(sep="") | int() %}

It would be nice just to do something similar to last items in arrays:

{% set num_last = number | last %}

Perhaps last could take a parameter, to change its function:

{% set num_last = number | last(type=character|word|digit) %}

I guess you could use the trick that the last digit of a number is its modulo 10.

{% set num_last = number % 10 %}