implemented substr (in an unsafe way)