applyStylesIf

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