withSpan

Method to simplify the code needed to apply spans on a specific sub string.