applyStylesIf

Apply the HTML formatting to the string only if if this condition is true.