You could even use lastIndexOf and substring.