Dollar General’s stock rallies as sales rose more than expected and the company took market share from its rivals.