Completed astrspn and astrstr functions