Changed to use the apache commonns StringUtils class.