rewrite startswith and endswith ,and change to inline function