xstring: shorter, safer implementation of getExtension