Improved StringExtension.swift using optional chaining